-
-
Notifications
You must be signed in to change notification settings - Fork 118
Adding an exptime calculator, Telescope class, and sky model #420
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
base: main
Are you sure you want to change the base?
Conversation
Test failures are symptoms of a broken CI on UPDATE: Yup, I fixed it, but it needs to be merged first before you can reap the benefit here via a rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @tcjansen ! Indeed, the workflow looks much better as part of astroplan
, at least to me.
As I have reviewed the rest before, just some minor comments remain and a thought about caching the download.
Comments for the notebook
- Remove commented
# warnings.filterwarnings("ignore", module='astropy.io.votable.tree')
. - Fix an extraneous
</tt>
showing in rendered notebook at the beginning of Section 3.
astroplan/skycalc.py
Outdated
transmission = hdu[1].data["TRANS"] | ||
|
||
# Delete the file after reading from it | ||
os.remove(tmp_data_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if astroplan
has some sort of caching mechanism so that calling this function repeatedly will not result in a network call if a previously downloaded file exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmorris3? I don't know anything about how caching works in python (or otherwise.. 😬)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
astroplan doesn't do any caching to prevent network calls yet, but we can imagine making a cache specifically for this kind of query.
Thanks for looking it over @pllim! Sorry it was unusually sloppy, I forgot to run pycodestyle before pushing 😱 (I used to have my sublimelinter running but it has mysteriously stopped showing me errors...) |
a5a21cf
to
a677e74
Compare
@tcjansen , tests are fixed for |
__all__ = ['skymodel'] | ||
|
||
|
||
def skymodel(airmass=1.0, pwv_mode='pwv', season=0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow up: did the SkyCalc CLI folks ever get back to you via email about adding it to astroquery? I still think that's the best way to go for the future of this particular method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They did! They said I should feel free to go ahead and make a PR to astroquery, and that their "software developers would surely consider it" - not sure if that means they'd chime in on my PR or if they'd consider making their own PR at some point, but either way it sounds like they gave me the green light.
astroplan/exptime.py
Outdated
SpectralElement, Empirical1D) | ||
|
||
# set the forcing if the source spec and bandpass don't overlap | ||
# hmm.. how to decide? will set to taper for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, this is actually kind of an important distinction. The issue arises when the source spectrum and bandpass don't fully overlap - you can tell synphot to force the convolution anyway, either by making the incomplete spectral component taper to zero for its missing wavelengths, or by guessing/extrapolating what the remainder of the spectrum will be. Extrapolating might be okay if only a tiny bit of the spectrum is missing, but otherwise sounds a bit risky to me, which is why I chose to taper.
All that said, I think the best approach would be to add an optional parameter like force_overlap
to exptime_from_ccd_snr()
with a default of taper
, and perhaps raise a warning if this forcing is implemented (which synphot might already do, actually). That way the user could both be aware that they don't overlap and could decide for themselves how they want to handle it.
Hey @tcjansen – any chance you'll be able to address the comments above sometime? If not, no problem just let us know so someone else gets to it. Thanks again! |
Ohh my gosh thanks for the reminder, @bmorris3! For some reason I had it in my head that I was waiting for comments... Will get to it soon! |
Added some more comments – please also rebase when you get a chance. |
744b54f
to
c4437f8
Compare
So I tried adding synphot to this line but I'm getting a conflict error... what's the correct way of going about this? |
You'll need to rebase and then force-push your changes. I recommend you make a backup branch of your work by typing |
c4437f8
to
5e2cdfa
Compare
93974d9
to
78c036e
Compare
Ah okay, I misunderstood "rebase" to mean "squash". Now that the conflicts are fixed, travis is still angry... I tried a few different approaches to adding synphot to '.travis.yml' but no luck.. but I'm admittedly fumbling around in the dark since I'm not familiar with travis 😅 |
import astropy.units as u | ||
import numpy as np | ||
from astroplan import FixedTarget, Observer, Telescope | ||
from astroquery.gaia import Gaia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please move this line to the inside of the test function that calls the Gaia
module? It's part of the reason why the tests are failing.
Sorry to leave you hanging so long @tcjansen!
|
All of the additions I've made in this PR are motivated by adding an exposure time calculator to
astroplan
. To do so, the user supplies their own spectrum (or spectral model) of their target (in the following example aswaveset_of_target
andflux_of_target
), the desired signal to noise ratio (SNR) the user wants to reach, anastroplan
observer
object, and a newastroplan
telescope
object to a function calledexptime_from_ccd_snr
:To compute the exposure time needed to obtain the given SNR,
astroplan
needs to know some telescope specifications such as the gain, aperture area, and bandpass. The newastroplan.telescope.Telescope
object handles those parameters.astroplan
then convolves the bandpass, spectrum, and any other optional effects (such as ccd response) with the help ofsynphot
, whichastroplan
also uses to get the count rate of the mock observation.I have also added the option for the user to input a custom sky model to the Observer object (i.e. a model of the atmospheric transmission at the location of the observer). With the new skycalc module, the user can alternatively obtain a sky model generated from an arsenal of optional sky parameters via the SKYCALC sky calculator.
See here for a tutorial!
Much of the content of this PR has been reviewed in this PR to synphot, where we had originally thought these functions might go before deciding that
astroplan
would be more a more appropriate place!I haven't integrated the tests yet since I wanted to get this PR in ASAP, but they are coming soon (after which some minor changes may be made if I discover any buggy behavior)!
Update: this PR closes #29