sofia_redux.calibration.standard_model: Generating Models for Standards

Introduction

The sofia_redux.calibration.standard_model module provides some methods for generating flux models for standard sources, in the standard_model module. Currently, only HAWC+ standards (usually asteroids or planets) are supported.

Usage

If the pypecal package has been installed, the standard model program can be accessed with the command:

hawc_calibration

The program requires one argument, and has one optional argument. The required argument is the name of a file that lists the object and timestamps to generate models for. An example is:

2016-12-01 05:00:00    Ceres
2016-12-16 05:00:00    Ceres
2017-10-17 11:00:00    Ceres
2017-11-16 07:00:00    Ceres

The first column is the UTC date of the observation. The second column is the UTC time of the observation. The third column is the name of the calibration object. The script will generate a model for each time point in the file.

The script accepts a second, optional argument, which is the name of the desired ATRAN file to use. The script will look for the file in /dps/calibrations/ATRAN/fits. If it cannot find it there, it will try to find it in the limited collection of ATRAN files in this package. If this argument is not provided, the default ATRAN model will be used:

atran_41K_45deg_40-300mum.fits

Output

The resulting model is written to a file with the naming pattern:

HAWC_<target>_<date>_<altitude>_<zenith angle>.out

The contents of this file are:

Column

Title

Units

Description

0

lambda_ref

microns

Reference wavelength

1

lambda_mean

microns

Mean wavelength

2

lambda_1

microns

Mean wavelength weighted by photon distribution

3

lambda_pivot

microns

Conversion between F(lambda) and F(nu)

4

lambda_eff

microns

Effective wavelength

5

lambda_eff_jv

microns

6

lambda_iso

microns

Isophotal wavelength

7

lambda_rms

microns

RMS wavelength

8

width

microns

9

Response

W/mJy

10

F_mean

W/m^2/mum

Mean flux

11

Fnu_mean

Jy

Mean flux in Jy

12

ColorTerm

k0

13

ColorTerm

k1

14

Source Rate

Watts

Power of source

15

Source Size

pixels

Size of source

16

Sorce FWHM

arcsec

FWHM of source

17

Bkgd Power

Watts

Background Power

18

NEP

W/sqrt(Hz)

Noise Equivalent Power

19

NEFD

Jy/sqrt(Hz)

Noise Equivalent Flux Density

20

MDCF

mJy

21

Npix

Number of pixels in source

22

Lambda prime

23

Wavelength correlation

24

Filter

Name of the filer

Process overview

The overall process is fairly simple. Pass a model of the source flux through the transmission of the system (such as atmosphere, filter, instrument, etc) and calculate the total observed flux in each filter.

Source model

The model of the source’s flux is either pull from a Herschel model or generated. Major body source (Neptune, Uranus, Callisto, and Ganymede) are modeled by Herschel. The actual flux the source would generate at the time of the observation is the model flux scaled by the square of the distance ratio of the model and the actual observed distance. The scaling of the model is handled by the modconvert.py.

Asteroid do not have Herschel models, so the model flux needs to be generated. The model is a simple blackbody scaled by the location of the asteroid in the solar system. The generation of the asteroid model is handled by genastmodel2.py.

To handle either of these methods. the location of the source in the solar system at the time of the observation is needed. This is handled by horizons.py. This connects to JPL’s Horizons service using the astroquery package. This determines the ephemeris of the object at the time of obseration and returns the needed data for each model type.

Calibration

The source flux is mitigated by the transmission of the light through the atmosphere, the telescope assembly, and the filter. The background light from the sky, telescope, window, etc. are also included. Taking this all into account results in the mean flux from the source in each filter.

Reference/API

sofia_redux.calibration.standard_model.hawc_calibration Module

Generates models of calibration objects for HAWC+ observations

Functions

apply_scale_factor(herschel_file, outfile, ...)

Apply a scale factor to Herschel model to account for distance.

calibration(obs_file, atran)

Generate models of the observed flux from a target.

calibration_data_path()

Determine the location of calibration data.

check_args(args)

Verify calibration configuration is valid.

classify_target(target)

Determine if a target is a minor or major target.

generate_major_cal_outfile(row, atran, ...)

Generate the name of the output file for a major target.

generate_major_outfile(target, ...)

Generate the name of the output file for major targets.

generate_minor_cal_outfile(row, atran)

Generate the name of the output file for a minor target.

generate_minor_outfile(row)

Generate the name of the output file for a minor target.

main([args])

Entry point for calibration routines.

model_dist(target, caldata)

Determine the distance to a target in a Herschel model.

model_major_body(obs_times, caldata, atran)

Generate a model for a major target.

model_minor_body(obs_times, atran)

Generate a model for a minor target.

parse_args(args)

Parse the arguments for configuring calibrations.

parse_atran_filename(atran)

Pull the alittude and zenith angle from the ATRAN filename.

read_obstimes(obs_files)

Read in when the observations took place.

scale_factor(distance, params)

Determine the scale factor for accounting for distance to target.

select_herschel_file(target)

Determine the correct Herschel model to use for the target.

sofia_redux.calibration.standard_model.hawc_calib Module

Generate a thermal model for a given object at a specified time

Functions

hawc_calib(infile, atmofile[, outfile, iq, ...])

Calculate source flux from calibrated observations.

setup_temperatures()

Define the temperatures of background sources.

sofia_redux.calibration.standard_model.genastmodel2 Module

Generate thermal models for asteroids.

Functions

asteroid_model(params, date, time[, ...])

Generate a model of the flux from an asteroid.

check_args(args)

Check the command line arguments are valid.

interpolate_model(model_wave, model_flux[, ...])

Interpolate the thermal model at key filter wavelengths.

parse_args(args)

Parse the command line arguments.

write_models(model, fit, params, outfile)

Write all models to file.

sofia_redux.calibration.standard_model.horizons Module

Query the Horizons database at JPL for object information

Functions

asteroid_query(target, date, time)

Queries the JPL Horizons database for asteroid information.

configure_astroquery()

Configure query to JPL Hoizons.

get_elements(obj)

Query Horizons for orbital elements.

get_ephemerides(obj)

Query Horizons for ephemerides.

horizons_object(target, date, time)

Configure an object to query Horizons.

parse_elements(elements, ephem, timepoint)

Parse out key fields from Horzions query results.

parse_property(elements, prop)

Parse orbital elements for physical property.

simple_query(target, date, time)

Query the JPL Horizons database to get the distance to the target.

verify_object_name(obj)

Double-check that the Horizons query was for the correct object.

sofia_redux.calibration.standard_model.modconvert Module

Scale models to account for object distance

Functions

modconvert(infile, outfile[, scale_factor])

Scale a Herschel model by a constant factor.

plot_scaled_spectrum(wave, scaled_flux, ...)

Plot the scaled Herschel model.

read_infile(infile)

Read in a Herschel model.

sort_spectrum(freq, flux, brightness_temp)

Sort the flux and brightness temp by increasing wavelength.

write_scaled_spectrum(wave, scaled_flux, ...)

Write the scaled Herschel model to file.

sofia_redux.calibration.standard_model.thermast Module

Generate a themeral model of an asteroid

Functions

bbflux(omega, tss, w)

Calculate the modified blackbody flux from the asteroid.

correction_factor(phase_angle)

Calculate correction factor from asteroid's phase angle.

flux_at_w(warr, subsolar_temperature[, ...])

Calculate the thermal flux from a blackbody object.

planck_function(w, temp)

Evaluate the Planck function.

thermast(Gmag, pV, rsize, phang, dsun, dist)

Create a model of the thermal flux from an asteroid.

sofia_redux.calibration.standard_model.background Module

Derive flux expected from background sources

Functions

background_integrand_1(plancks, emissivity, ...)

Calculate the first background integral.

background_integrand_2(plancks, ...)

Calculate the second background integral.

background_integrand_coeff(numerator, warr, ...)

Coefficient of the background integral for each source.

background_power(telescope_area, omega_pix, ...)

Background power in the extraction area.

derive_background_photon_flux(warr, temperatures)

Setup planck functions for each non-target source.

integrand2(numerators, warr, temperatures, ...)

Calculate scale factors for terms in background_intetgral_2.

integrate_integrands(integrands, warr)

Integrate the functions set up in setup_integrands.

setup_integrands(total_throughput, ...)

Define all the integrands to be used.

sofia_redux.calibration.standard_model.calibration_io Module

Handle file I/O for model generation

Functions

calibration_data_path()

Location of local calibration data.

generate_blackbody(temp[, wmin, wmax])

Generate a simple blackbody spectrum.

generate_power_law(alpha[, wmin, wmax])

Generate a power law input spectrum.

model_spectrum(infile[, txt, dataframe, ...])

Read in or generate model spectrum.

open_outfile_and_header(outfile[, no_atm, ...])

Open the outfile and print all headers.

plot_spectrum(model_wave, model_flux, ...[, ...])

Generate a plot of the final spectrum.

read_atran(atmofile, ws[, no_atm, wmin, wmax])

Read in atmospheric transmission model.

read_fits(infile)

Read spectrum from a FITS file.

read_text(filename)

Read spectrum input file if formatted in plain text.

report_result(result, filter_name, outf)

Format the result of the calibration and report it.

unique_wavelengths(wavelengths, flux[, ...])

Select out a window of unique wavelengths.

sofia_redux.calibration.standard_model.derived_optics Module

Calculate properties of observations derived from the models

Functions

apply_filter(caldata, filter_name, ...)

Only select out wavelength and fluxes in a given filter.

color_terms(result, fref, pl, bb[, alpha, ...])

Calculate the color terms k0 and k1.

flux_reference_wavelength(result[, pl, bb, ...])

Calculate the flux from the model at reference wavelengths.

limiting_flux(result, integrals, snr_ref[, tref])

Calculate the minimum observable flux.

mean_fluxes(result, integrals)

Calculate the mean flux.

mean_pixels_in_beam(num_pix, ...)

Calculate the mean number of pixels in the beam.

noise_equivalent_power(bg_integrand1, ...)

Calculate the noise-equivalent power.

pointing_optics_sigma(iq)

Calculate the quality of the pointing optics.

response(result, integrals)

Calculate the instrument response.

source_descriptions(result, integrals, ffrac)

Calculate various optical properties of the source.

source_size(warr, iq, theta_pix)

Compute the source size.

sofia_redux.calibration.standard_model.isophotal_wavelength Module

Calculate various isophotal wavelengths

Functions

calc_isophotal(result, wavelengths, pl, ...)

Calculated the isophotal wavelengths.

calculated_lambdas(result, integrals)

Calculate various characteristic wavelengths.

find_isophotal_candidates(warr, flux_reduced)

Find where the flux is equal to the mean flux.

interpol(v, x, xout)

Interpolates v(x) at points xout.

isophotal_from_powerlaw(result, alpha[, ...])

Calculate the isophotal wavelengths for a power law model.

isophotal_from_zeros(wave_zeros, taf, ...)

Calculate the isophotal wavelengths from zero points.