Extra Functions
Created on Mon Nov 20 15:08 2023
@author: MCR
Extra functions for use alongside the main pipeline.
- exotedrf.extra_functions.download_observations(proposal_id, instrument_name=None, objectname=None, filters=None, visit_nos=None)
Directly download uncal files associated with a given observation from the MAST archive.
- Parameters:
proposal_id (str) – ID for proposal with which the observations are associated.
instrument_name (str) – Name of instrument data to retrieve. NIRISS/SOSS, NIRSPEC/SLIT currently supported. (optional).
objectname (str) – Name of observational target. (optional).
filters (str) – Instrument filters to retrieve.
visit_nos (int, array-like(int)) – For targets with multiple visits, which visits to retrieve.
- exotedrf.extra_functions.download_ref_file(filename, origin, destination)
Download reference files (from crds or elsewhere).
- Parameters:
filename (str) – Name of the file to download.
origin (str) – Url at which the file is located.
destination (str) – Path to directory to which to save the downloaded file.
- exotedrf.extra_functions.get_throughput_from_photom_file(photom_path)
Calculate the throughput based on the photom reference file. Function from Loïc, and is apparently the proper way to get the throughput? Gives different results from contents of spectra reference file.
- Parameters:
photom_path (str) – Path to photom reference file
- Returns:
w1 (np.array(float)) – Order 1 wavelength axis.
w2 (np.array(float)) – Order 2 wavelength axis.
thpt1 (np.array(float)) – Order 1 throughput values
thpt2 (np.array(float)) – Order 2 throughput values
- exotedrf.extra_functions.make_smoothed_2d_lightcurve(spec, baseline_ints, nint, dimx, filename, order=1, tscale=3, wscale=9)
Smooth extracted 2D SOSS light curves on specified time and wavelength scales to use as input for chromatic 1/f correction.
- Parameters:
spec (array-like(float)) – Extracted 2D light curves.
baseline_ints (int, array-like(int)) – Integrations or ingress and/or egress.
nint (int) – Number of integration in exposure.
dimx (int) – Number of wavelength bins in exposure.
filename (str) – File to which to save results.
order (int) – SOSS diffraction order being considered.
tscale (int) – Timescale, in integrations, on which to smooth. Must be odd.
wscale (int) – Timescale, in wavelength bins, on which to smooth. Must be odd.
- exotedrf.extra_functions.refine_soss_timestamps(mid_int_times, centroids, subarray='SUBSTRIP256', outfile=None)
SOSS read times are long compared to other instruments meaning that there are several seconds of time difference between when red and blue wavelengths are read. For limb asymmetry studies, this can be important. This function refines the default mid integration times to yield a seperate timestamp for each wavelength, which can then be outputs as 2D maps, or appended to an existing spectrum file. Note, when binning these time stamps it is important to also consider the relative contributions of each wavelength to the bin via the brightness of the stellar spectrum.
- Parameters:
mid_int_times (array-like(float)) – Default mid-integration timestamps.
centroids (dict) – Centroids dictionary.
subarray (str) – SOSS subarray identifier, either “SUBSTRIP256” or “SUBSTRIP96”.
outfile (str, None) – Spectrum file to which to append output.
- Returns:
int_times_o1 (ndarray(float)) – Integration times for each wavelength in order 1.
int_times_o2 (ndarray(float), None) – Integration times for each wavelength in order 2.