obstools.lmi_etc module

LMI Exposure Time Calculator Module

LDTObserverTools contains python ports of various LDT Observer Tools

Lowell Discovery Telescope (Lowell Observatory: Flagstaff, AZ) https://lowell.edu

This file contains the LMI exposure time calculator routine (ported from PHP) from Phil Massey’s webpage. http://www2.lowell.edu/users/massey/LMI/etc_calc.php

These routines are used for computing the required exposure times for LMI based on various requirements.

The values for Star20 are the count rates in e-/sec/image at airmass=0 for a 20th magnitude star measured with a radius = 1.4 x FWHM in pixels.

Warning

The LMI-specific pixel scale, gain, and readnoise are hard-coded into this module.

Note

A GUI wrapper for these functions is forthcoming.

Todo

Refactor this into a class to eliminate the continual passing back and forth of the same arguments.

class obstools.lmi_etc.LmiEtc[source]

Bases: ScriptBase

Script class for lmi_etc tool

Script structure borrowed from pypeit.scripts.scriptbase.ScriptBase.

classmethod get_parser(width=None)[source]

Construct the command-line argument parser.

Parameters:
  • description (str, optional) – A short description of the purpose of the script.

  • width (int, optional) – Restrict the width of the formatted help output to be no longer than this number of characters, if possible given the help formatter. If None, the width is the same as the terminal width.

  • formatter (HelpFormatter) – Class used to format the help output.

Returns:

ArgumentParser – Command-line interpreter.

static main(args)[source]

Main Driver

Simple function that calls the main driver function.

obstools.lmi_etc.check_etc_inputs(airmass: float, phase: float, seeing: float, binning: int, exptime=None, mag=None, snr=None)[source]

Check the ETC inputs for valid values

Does a cursory check on the ETC inputs for proper range, etc. These are not exhaustive checks (i.e. checking for proper type on all values), but a good starting point nonetheless.

Parameters:
  • airmass (float) – Airmass at which the observation will take place

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD

  • exptime (float, optional) – User-defined exposure time (seconds) (Default: None)

  • mag (float, optional) – Magnitude in the band of the star desired (Default: None)

  • snr (float, optional) – Desired signal-to-noise ratio [Default: None]

Raises:

ValueError – If any of the inputs are deemed to be out of range

obstools.lmi_etc.counts_from_star_per_sec(band_dict: dict, mag: float, airmass: float)[source]

Compute the counts per second from a star

Compute the counts per second from a star given a band, magnitude, and airmass.

Parameters:
  • band_dict (dict) – The dictionary from get_band_specific_values() containing star20 and sky

  • mag (float) – Magnitude in the band of the star desired

  • airmass (float) – Airmass at which the observation will take place

Returns:

float – Number of counts per second for the described star

obstools.lmi_etc.exptime_given_peak_mag(peak: float, mag: float, airmass: float, band: str, phase: float, seeing: float, binning: int = 2)[source]

Compute the exposure time given peak and mag

Given a desired peak count level on the CCD and stellar magnitude, compute the exposure time required for a particular LMI Filter, moon phase, seeing and CCD binning.

Parameters:
  • peak (float) – Desired peak count level on the CCD (e-)

  • mag (float) – Magnitude in the band of the star desired

  • airmass (float) – Airmass at which the observation will take place

  • band (str) – The LMI filter for which to perform the calculation

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD (Default: 2)

Returns:

float – The desired exposure time in seconds

obstools.lmi_etc.exptime_given_snr_mag(snr: float, mag: float, airmass: float, band: str, phase: float, seeing: float, binning: int = 2)[source]

Compute the exposure time given SNR and magnitude

Given a desired signal-to-noise ratio and stellar magnitude, compute the exposure time required for a particular LMI Filter, moon phase, seeing and CCD binning.

Parameters:
  • snr (float) – Desired signal-to-noise ratio

  • mag (float) – Magnitude in the band of the star desired

  • airmass (float) – Airmass at which the observation will take place

  • band (str) – The LMI filter for which to perform the calculation

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD (Default: 2)

Returns:

float – The desired exposure time in seconds

obstools.lmi_etc.get_band_specific_values(band: str)[source]

Return the band-specific star and sky values

Pull the correct row from etc_filter_info.ecsv containing the star count and sky parameters (brightness and extinction).

Parameters:

band (str) – The LMI filter to use

Returns:

dict – The dictionary representation of the table row. If the band is improperly specified (i.e. is not in the table), return an empty dictionary.

obstools.lmi_etc.mag_given_snr_exptime(snr: float, exptime: float, airmass: float, band: str, phase: float, seeing: float, binning: int = 2)[source]

Compute the magnitude given SNR and exposure time

Given a desired signal-to-noise ratio and exposure time, compute the limiting magnitude for a particular LMI Filter, moon phase, seeing and CCD binning.

Parameters:
  • snr (float) – Desired signal-to-noise ratio

  • exptime (float) – User-defined exposure time (seconds)

  • airmass (float) – Airmass at which the observation will take place

  • band (str) – The LMI filter for which to perform the calculation

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD (Default: 2)

Returns:

float – The limiting stellar magnitude

obstools.lmi_etc.number_pixels(seeing: float, binning: int)[source]

Number of pixels in the measuring aperture

Counts the number of pixels in the measuring aperture, based on the seeing and CCD binning scheme.

Note

The minimum value of the return value N_pix is 9, which corresponds to a FWHM of 2.54 pixels. For 2x2 binning, this occurs at a seeing of 0.61” (3x3 binning = 0.91”, 4x4 binning = 1.22”).

Parameters:
  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD

Returns:

float – Equivalent number of pixels within the measuring aperture

obstools.lmi_etc.peak_counts(exptime: float, mag: float, airmass: float, band: str, phase: float, seeing: float, binning: int = 2)[source]

Compute the peak counts on the CCD for an exptime and mag

Given a desired exposure time and stellar magnitude, compute the resulting counts on the CCD for a particular LMI Filter, moon phase, seeing and CCD binning.

Parameters:
  • exptime (float) – User-defined exposure time (seconds)

  • mag (float) – Magnitude in the band of the star desired

  • airmass (float) – Airmass at which the observation will take place

  • band (str) – The LMI filter for which to perform the calculation

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD (Default: 2)

Returns:

float – The desired counts on the CCD (e-)

obstools.lmi_etc.read_noise_contribution(seeing: float, binning: int)[source]

Calculate read-noise contribution

Compute the read-noise contribution to the measuring aperture by multiplying the read noise per pixel by the square root of the number of pixels.

Parameters:
  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int) – Binning of the CCD

Returns:

float – The read-noise contribution to the photometry aperture

obstools.lmi_etc.sky_count_per_sec_per_ap(band_dict: dict, phase: float, seeing: float, binning: int)[source]

Determine sky counts per aperture per second

[extended_summary]

Parameters:
  • band_dict (dict) – The dictionary from get_band_specific_values() containing star20 and sky

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int) – Binning of the CCD

Returns:

float – Sky counts per second in the aperture

obstools.lmi_etc.snr_given_exptime_mag(exptime: float, mag: float, airmass: float, band: str, phase: float, seeing: float, binning: int = 2)[source]

Compute the SNR given exposure time and magnitude

Given a desired exposure time and stellar magnitude, compute the resulting signal-to-noise ratio for a particular LMI Filter, moon phase, seeing and CCD binning.

Parameters:
  • exptime (float) – User-defined exposure time (seconds)

  • mag (float) – Magnitude in the band of the star desired

  • airmass (float) – Airmass at which the observation will take place

  • band (str) – The LMI filter for which to perform the calculation

  • phase (float) – Moon phase (0-14)

  • seeing (float) – Size of the seeing disk (arcsec)

  • binning (int, optional) – Binning of the CCD (Default: 2)

Returns:

float – The desired signal-to-noise ratio