Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalizing multiple target stars #137

Open
PK0207 opened this issue Mar 1, 2022 · 9 comments
Open

Normalizing multiple target stars #137

PK0207 opened this issue Mar 1, 2022 · 9 comments
Assignees
Labels
Easy Easy Difficulty: Requires little coding knowledge, just some googling. good first issue Good for newcomers

Comments

@PK0207
Copy link
Contributor

PK0207 commented Mar 1, 2022

Choosing reference stars issue has been resolved, and methodology has been changed to using a linear fit on the reference stars and using that to correct the target star magnitude. This is a simple photometric process. Now we need to ensure that the program is tested, and is written more efficiently. Currently, the program uses a lot of memory. Also, the click command norm_sources is not implemented. This needs some testing of collate and the performance of subtract. Then we can generalize the code to perform normalization for all the variable stars in the image at once.

Originally posted by @PK0207 in #82 (comment)

Now that the reference stars are chosen, and the normalization method we used has been proven to work, the next step is to make it so that we can feed a list of target stars into the script, and produce lightcurves for all of the sources found. For now, this can still be an unautomated process.

The script to implement this on is on the mags_testing branch, called mags.py .

@PK0207
Copy link
Contributor Author

PK0207 commented Mar 1, 2022

Steps (that I see so far):

  1. in the find_ref() function, make sure that we can either passs more than one target star through, or we will have to run it through a for loop.
  2. The photometry() function can only run one star at a time. We could make a try except loop to run more than one target star through it.
  3. comp_coords definition can be put in a for loop to run it over more than one target star
  4. Run cluster_search_radec in a for loop to find more than one target star
  5. For the large for loop from line 182 onwards, we need to edit this basically.

NOTE: We SHOULD NOT find new reference stars every time, and we SHOULD NOT run photometry on the reference stars multiple times (unnecessary overhead)

@PK0207 PK0207 added Easy Easy Difficulty: Requires little coding knowledge, just some googling. good first issue Good for newcomers labels Mar 1, 2022
@PK0207
Copy link
Contributor Author

PK0207 commented Mar 28, 2022

Changed line 131 in mags.py to read:
target_coord = SkyCoord(ims[0]['CAT'].data['ra'],ims[0]['CAT'].data['dec'], frame= 'icrs',unit='degree')
to normalize every target star in the image. This will take a while, but the code should be able to run multiple target stars as of right now. As this runs I will confirm this.

@PK0207
Copy link
Contributor Author

PK0207 commented Mar 30, 2022

  1. Each function/step of normalization should be able to run either one or multiple targets through.
  2. photometry(): when we run it on more than one target star, putting it through a for loop would run masking more than once on a single image which is redundant. The rest of the function can take 1D arrays of x and y. No try except loop necessary. Luca's masking might be used to replace the masking in the photometry() function, so we can split the function up into masking and aperture photometry.
  3. Put calculation of instrumental_mag before picking reference stars brighter than the target so that the selection is optimal. We might also be able to put conversion of Gaia reference star magnitudes to SDSS g' before selecting the stars brighter than the target star.
  4. Addressing the comment on line 200&207 should fix the IndexError we are getting now
  5. If no viable reference stars, we could increase the search radius or put in an NA value. [First have to test how badly increasing the search radius affects results]. Increasing the search radius should only happen under certain conditions (tbd).

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 3, 2022

Made the changes of steps 3 and 4, but the IndexError remains. I don't know why though.

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 4, 2022

Caught the error: target is being shortened by removing wherever there are zeros in target['x'], but ims are not being shortened to have those same indices. Change solved that error.

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 4, 2022

Rearranging code so that the instrumental magnitude for comp_stars are calculated before the target instrumental magnitude so that a comparison can be made between them to find reference stars that are brighter than the target star. First, and second run through worked.

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 4, 2022

Taking a look at the fit plots to see how well the fit worked:
lol no
image
Second one is better
image

Most of them look like the first one, so that's no good.

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 5, 2022

Increasing the search radius to 0.04 (from 0.03) fixes this problem. It is clear that developing an adaptive method to find reference stars is essential.

@PK0207
Copy link
Contributor Author

PK0207 commented Apr 5, 2022

The errors are still large, so checking if increasing the radius to 0.05 helps (for the first three stars)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Easy Difficulty: Requires little coding knowledge, just some googling. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants