Aperture mask development #15
Conversation
Created an aperture class
To show new aperture class
Adjusted code to make get_aperture function
Updated poetry lock (lightkurve#14)
jorgemarpa
left a comment
There was a problem hiding this comment.
I think the algorithm implementation looks good and behives as expected. We would need to refine the documentation for the aperture module, adding docstrings for all methods, type hits to be consistent, and clarifying some descriptions.
The aperture module needs to be generalized for Kepler and TESS missions, particularly when coverting magnitudes to flux space.
This also needs code testing.
| compute the simple aperture. | ||
| crowding_metric: Float | ||
| The crowding metric reflects what fraction of the flux in the aperture is due to the target itself not the nearby | ||
| light sources. Should be flux of source/total flux of everything in the prf data cube. |
There was a problem hiding this comment.
Maybe add that 1 means no contamination.
| model_prf = [], #Must be an 3D array | ||
| target_index: int = 0, # The index that the target prf is stored in | ||
| tess_mag = list[float]) -> float: # Must match length of self[0:] and must be an array | ||
|
|
| """Converts the prf model(s) into flux using input tess magnitudes | ||
| """ | ||
|
|
||
| zpt = 20.44 |
There was a problem hiding this comment.
lkprf is also for Kerpler data, we should make this generic either by providing a ZP value or reading this from a global (?) dictionary with values for multiple supported missions.
| The flux fraction is similar to excess flux leaking into the aperture, a fraction of the PRF of the | ||
| target may not be captured in it. | ||
| To account for this missing fraction, the flux fraction is computed.""" |
There was a problem hiding this comment.
does this apply to this method's documentation?
| not the nearby light sources. Should be flux of source/total flux of everything.""" | ||
|
|
||
| # Need to convert into flux first | ||
| model_prf_flux = self._compute_prf_flux() |
There was a problem hiding this comment.
it's seems you're running this several times, eventhough computing time is very small, maybe we should run it during class initialization and have it as an attribute?
|
|
||
| Returns | ||
| ------- | ||
| A boolean array which can be used as an aperture within lightkurve. |
There was a problem hiding this comment.
update returns with the actual returned vaiables, ap, di
| "There are three kinds of aperture that we will implement:\n", | ||
| "\n", | ||
| "- Simple: This computes that aperture that covers the total light of the targets PRF. This is a very simple aperture which should only be used for bright isolated stare. The user determines the level of target flux to be included within the aperture using a completeness metric.\n", | ||
| "- Strict: This aperture is calculated using a measurement of the target flux / flux from all other contaminating sources. In this method the PRF is computed for the target and for other contaminating stars within the surronding region. The cumulative signal to noise is then calculated for the target and the local minima derived. This is then used to compute the size of the aperture mask.\n", |
There was a problem hiding this comment.
should be:
This is then used to compute the aperture mask.
without the size of
| "source": [ | ||
| "### Defining a simple function\n", | ||
| "\n", | ||
| "Much of this tutorial depends on deriving fundamental information from the header of the DataCube. This includes WCS infomration which will be used to convert object R.A and Dec values into x, y pixel positions such that a PRF model can be created. To enable this we have defined the following `get_surronding_objects` function." |
| "shape = tess_hdulist[1].data['FLUX'].shape[1:]\n", | ||
| "\n", | ||
| "# initialize the PRF object\n", | ||
| "prf_initial = lkprf.TESSPRF(camera=camera, ccd=ccd, sector=sector) " |
There was a problem hiding this comment.
I'd call this object prf_model to be more descriptive
| "# Plot the real data. We randomly select the 100th observation from the TPF data cube\n", | ||
| "data = axs[1].imshow(tess_hdulist[1].data['FLUX'][100,:,:], vmin=0, vmax=40000, origin='lower')\n", | ||
| "axs[1].set_title('Data')\n", | ||
| "for a in range(len(target_list)):\n", |
There was a problem hiding this comment.
we should plot the target with a different marker
Here i have created code in which a user can select 3 different kinds of aperture masks.