Skip to content

Aperture mask development #15

Open
rebekah9969 wants to merge 13 commits into
lightkurve:mainfrom
rebekah9969:main
Open

Aperture mask development #15
rebekah9969 wants to merge 13 commits into
lightkurve:mainfrom
rebekah9969:main

Conversation

@rebekah9969
Copy link
Copy Markdown

Here i have created code in which a user can select 3 different kinds of aperture masks.

Copy link
Copy Markdown

@jorgemarpa jorgemarpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/lkprf/prfmodel.py
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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add that 1 means no contamination.

Comment thread src/lkprf/aperture.py
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add docstrings here

Comment thread src/lkprf/aperture.py
Comment on lines +27 to +30
"""Converts the prf model(s) into flux using input tess magnitudes
"""

zpt = 20.44
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/lkprf/aperture.py
Comment on lines +106 to +108
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."""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this apply to this method's documentation?

Comment thread src/lkprf/aperture.py
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()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread src/lkprf/prfmodel.py

Returns
-------
A boolean array which can be used as an aperture within lightkurve.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infomration -> information

"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) "
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should plot the target with a different marker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants