Calibration Utilities
zeustools.bpio module
- zeustools.bpio.extract_from_beamfile(fname, beam, spat, arrnums)
DEPRECATED, since Bo’s script now uses different formatting Sometimes you want to read out the reduced data for individual beams from Bo’s reduction script. This is the function that handles that. Given a filename, this will grab one spatial position from that beam.
- Parameters
fname – the file name of the beamfile that you want to load
beam – the beam number that you want to extract
spat – the spatial position you want
arrnums – determines whether you get the data before or after the dead pixel subtraction, clean routine, independent component analysis, etc. Ask Bo what number you should input.
- Returns
a 4xn array, where return[0:4] are spatial position, signal, noise, and weight.
- zeustools.bpio.extract_one_spatial_position(a, spat)
DEPRECATED, since Bo’s script now uses different formatting Takes the numpy z file from Bo’s script and return a 1-d spectrum of a single spatial position.
- Parameters
a – this is the npz load object, loaded from Bo’s reduction script
spat – This is the spatial position you would like to extract.
- Returns
a 4xn array, where return[0:4] are spatial position, signal, noise, and weight.
- zeustools.bpio.load_data_and_extract(fname, spat, err_file=None)
Automatically loads an csv file from Bo’s reduction script and returns a 1-d spectrum of a single spatial position.
- Parameters
fname – this is the filename of the .npz file from Bo’s script
spat – This is the spatial position you would like to extract.
- Returns
tuple of: 1d array of spectral position, 1d array of spectrum, and 1d array of noise. Both sig and noise arrays are masked arrays, where the mask has been set to True for nans
zeustools.calibration module
- zeustools.calibration.bb_temp_watts(obs_wavelength, pixel_deltalambda, source_temp=<Quantity 270. K>)
Get the power in W that the detectors see when looking at a source. This is useful for dark IV tests and stuff
- Parameters
obs_wavelength – Astropy Quantity containing the wavelength observed
pixel_deltalambda – Astropy Quantity containing the difference in wavelength between light seen by the line pixel and a pixel next to it. TODO: how linear is it really?
source_temp – astropy quantity source temperature - 77 K for LN2, ~285 K for roomtemp
- zeustools.calibration.flat_to_wm2(sky_transparency, obs_wavelength, pixel_deltalambda, sky_temp=<Quantity 270. K>, cabin_temp=<Quantity 288. K>, beam_size=<Quantity 9.58774897e-10 sr>)
Get the power in W/m^2/bin that the detectors see when doing a skychop. This can be multiplied by the flat-divided spectra later.
- Parameters
sky_transparency – The line-of-sight transparency of the sky. This is usually calculated by get_real_pwv, then querying the APEX sky model.
obs_wavelength – Astropy Quantity containing the lab-frame wavelength of the line
pixel_deltalambda – Astropy Quantity containing the difference in wavelength between light seen by the line pixel and a pixel next to it. TODO: how linear is it really?
sky_temp – astropy quantity guess of sky temperature - usually around 0 Celsius
cabin_temp – astropy quantity temperature in cabin
beam_size – astropy quantity beam size
- zeustools.calibration.get_real_pwv(pwv, altitude)
Given the zenith PWV (reported by APEX) and altitude of source, returns the real amount of water between the telescope and space.
Basically returns pwv/cos(zenith_angle)
- Parameters
pwv – zenith PWV reported by APEX
altitude – Altitude of source
zeustools.calibration_pipeline module
- zeustools.calibration_pipeline.contsub(data, line_px)
- zeustools.calibration_pipeline.cut(data, min_px, max_px)
- zeustools.calibration_pipeline.flux_calibration(data, flat_flux_density)
- zeustools.calibration_pipeline.get_drop_indices(spec_pos, px_to_drop)
- zeustools.calibration_pipeline.getcsvspec(label, spec)
- zeustools.calibration_pipeline.plot_spec(spec, saveas, bounds, do_close=True)
- zeustools.calibration_pipeline.run_pipeline()
- zeustools.calibration_pipeline.shift_and_add(data1, data2, px1, px2)
takes in two spectra. Shifts the second one spectrally by px_offset to align the line pixel between the two runs. Weights the spectra appropriately TODO: use np.average to clean up this mess.
- zeustools.calibration_pipeline.wavelength_calibration(data, position_of_line, bin_width)