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

Faster contrast curves #136

Merged
merged 64 commits into from
Feb 22, 2024
Merged

Faster contrast curves #136

merged 64 commits into from
Feb 22, 2024

Conversation

cdressing
Copy link
Contributor

Description

Sped up contrast curve generation by using the measured FWHM to set the sizes of the fake images.

Motivation and Context

Contrast curve generation was previously much slower (roughly 160 s per image). Depending on the FWHM, contrast curve generation can now be completed in under 10 seconds.

How Has This Been Tested?

Compared to contrast curves previously generated by David Ciardi using his IDL code.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

When using csv files for logs, save version with darks to a new file (marked by "_with_darks.csv") so that darks are not appended repeatedly when the pipeline is rerun.
Set default reduction method using bracket notation instead of dot notation because the column isn't actually added to the data frame when using dot notation.
Check if specified reduction directory exists and create it if needed.
Corrected description of reddir.
Share original filenames with plot_array so that the shift1_cube.png files can be annotated with filenames.
If ShARCS dataset contains BrG-2.16 data and no corresponding flat, use the Ks flat instead.
Label each subpanel with filename or star name. Add new functionality for plotting reduced images of all stars observed on a single night.
For ShARCS, if no BrG-2.16 flat exists, use Ks flat for reducing BrG-2.16 data. Also removed leftover stray comments.
Removed previously commented out text changing head.update to head.set.
Corrected typo (missing = in equality check).
Corrected typo (missing : before if/then statement)
Changed literal eval to avoid issues when filenames have leading zeros.
Added ability to save time by using existing darks, flats, and skies.
Added if statement to tell the code when to use the "all_stars" version of the plot.
Added snames=None to ensure that all plotting routines are compatible with the addition of plot_all_stars
Corrected typos in plot_all_stars.
Truncate error array to the inner 10" so that lim_arc_lengths, delta_mags, and lim_stds are all the same length.
correct typo in comments (afrer --> after)
Automatically run contrast curve code for each star and save plots and csv files showing contrast as a function of angular separation.
fixed typo in generation of lim_stds
Flipped y-axis to show brighter objects at top.
Produce grid of all images and plot showing all contrast curves.
added a space to improve readability
Produce grid showing reduced images for all stars observed and plot showing all contrast curves.
When plotted in a grid, flats are now shown with a narrower, adaptive color scaling range and labeled by file name.
When run with verbose=False, warning messages from concur are suppressed to avoid messing up the progress bars.
Cast header['CRPIX1'] and header['CRPIX2'] as floats to prevent errors that occur when they are read in as integers.
cdressing and others added 28 commits March 29, 2022 12:34
Don't run darks, flats, and sky drivers again after registering images.
Don't print to screen unless VERBOSE is set. Allow all types of flats to match (e.g., sky flats, dome flats, flats) and improve matching of images taken in J+Ch4-1.2 by allowing different filter capitalization and whitespace in the logsheet.
Return configuration file when user requests to skip data reduction.
corrected a minor typo in comments
Made larger intermediate images (800x800 pixels versus 600x600) to avoid edge effects in final 600x600 pixel images. Changed contrast curve spacing to <= 0.5" beyond FWHM. Made larger fake images to avoid cases where sky annulus falls outside the fake image for high FWHM.
Move contrast curves into a central directory and format as needed for TRICERATOPS runs.
Now use 1000x1000 pixel images for majority of process instead of 800x800 pixel images. Removed hardcoding of initial image size when trimming down to the final image.
TRICERATOPS can't handle missing contrast curve values, so now rows with missing values are removed from the contrast curve dataframe before saving to file.
Restricted possible image centers to central region when using shift_bruteforce to avoid selecting bright image edges.
Use astropy.convolution to interpolate over NaNs before registration. Fixes issue with  shift (from scipy.ndimage.interpolation) generating images that are completely NaN if the input image contains NaNs.

Also fixed typo in comment in drivers.
Properly handle observations taken in J+Ch4-1.2 by reading both filters in the FITS header and saving files accordingly.
Make separate folders for J+Ch4-1.2 files
Increased default maximum allowed image shift from 200 pixels to 350 pixels in registration.py. Improved handling of NaNs in skies and image reduction. Corrected typos in comments.
Added option to run image drivers and registration for only a subset of stars. Need to improve tracking of reduction methods for selected star registration. Currently assuming "saturated" by default.
Sped up contrast curve code 20-30x by using the FWHM to set the size of the fake image.
Updated size used for fake images to 5 pixels wider than the size used for the outer radius of the sky annulus.
Deal with gaps in list of images. Without this fix, only the final set of images is used for each star/filter combination.
Also deal with breaks in the lists of flats, darks, and skies. Previously, the code just used a single set rather than combining sets of images with a given exposure time and filter.
corrected typo (skis --> skies)
Streamline handling of flats and skies.
Corrected bug in splitting skies by filter. Switched to adaptive color scaling for grids of skies.
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (ca92a89) 76.31% compared to head (5fe44be) 76.04%.

Files Patch % Lines
src/simmer/analyze_image.py 12.50% 7 Missing ⚠️
src/simmer/drivers.py 46.15% 7 Missing ⚠️
src/simmer/image.py 78.57% 3 Missing ⚠️
src/simmer/contrast.py 33.33% 2 Missing ⚠️
src/simmer/insts.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
- Coverage   76.31%   76.04%   -0.26%     
==========================================
  Files          25       25              
  Lines        2296     2346      +50     
==========================================
+ Hits         1752     1784      +32     
- Misses        544      562      +18     
Flag Coverage Δ
unittests 76.04% <67.21%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arjunsavel arjunsavel merged commit d260429 into arjunsavel:main Feb 22, 2024
4 of 8 checks passed
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.

None yet

2 participants