original_src

apt_sql.py

class jwst_rogue_path_tool.original_src.apt_sql.Sqlfile(sqlfile)

An sql file exported by APT.

browser(table)

Diplay copy of astropy table in a browser window. Convert underscores to spaces in column headers to allow wrapping.

cols_from_rows(rows, keys)
keys(rows)
rows_from_sql(tablename)

Return dictionary for each row in the specified table. Dictionary keys may differ for each sql insert statement.

sqlread()

Read sql file exported by APT. Strip trailing newlines.

table(tablename, browser=False)

Construct astropy table from sql insert statements. For the ‘exposures’ table, discard rows with apt_label == ‘BASE’. Convert column data type to integer or float, where possible. Strip beginning and ending single quote from strings.

tablenames()

Parse sql insert statements to determine table names.

jwst_rogue_path_tool.original_src.apt_sql.arguments()

Parse and return command line arguments.

jwst_rogue_path_tool.original_src.apt_sql.main()

claws_tool.py

Module to predict the presence of the stray-light artifacts know as claws in NIRCam Imaging observations, specified in APT.

Authors

  • Mario Gennaro

class jwst_rogue_path_tool.original_src.claws_tool.apt_program(sqlfile, instrument='NIRCAM')

Class that handles the APT-program-level information. It can configure “observation” objects based on the desired observation ids, and can cal the observation.check_multiple_angles method to perform a check of stars in the susceptibility region for all the exposures of a given observation and for multiple observations of a given program

add_observations(obsids=None, catargs={'band': 'K', 'inner_rad': 8.0, 'maxmag': 4.0, 'outer_rad': 12.0, 'simbad_timeout': 200, 'sourcecat': 'SIMBAD', 'verbose': True}, smallregion=False)

Configure multiple observations and append them to the self.observations list

Parameters

obsid: list of Pandas indexes

IDs of the observations to add. If None, all the opbservations in the prgram will be added

catargs: dictionary

parameters to be passed to the get_catalog method of an observation object

check_observations(obsids=None, angstep=0.5, RP_padding=0)

Convenience function to check multiple observations for stars in the susceptibility region

Parameters

obsid: list of Pandas indexes

IDs of the observations to check. If None, all the opbservations in the prgram will be added

angstep: float

The resolution at which to scan the whole (0,360) range of PAs, in degrees

RP_padding: float

Extra padding around the susceptibility region (stars outside the nominal SR, but within RP_padding are flagged as “inside”)

configure_observation(obsid, catargs, smallregion=False, nes=None)

Create an observation object

Parameters

obsid: index of a Pandas dataframe

Represents the observation ID of interest

catargs: dictionary

parameters to be passed to the get_catalog method of an observation object

smallregion: boolean

if True restricts the search to a smaller susceptibility region in the rogue path

nes: integer

specifies which exposure_spec_order_number to use. If None, the code will select the exposure_spec_order_number corresponding to the highest number of expected counts (based on photon collecting time and zero point value)

Returns

An observation object. Returns None if no exposures are present with the input obsid in the APT-exported sql file

jwst_rogue_path_tool.original_src.claws_tool.compute_line(startx, starty, angle, length)
class jwst_rogue_path_tool.original_src.claws_tool.emp_zero_point

Get an empirical zp given the module and the PUPIL+FILTER combo

get_emp_zp(module, pupilshort, filtershort)
get_ground_band(pupilshort, filtershort, catalog='2MASS')
class jwst_rogue_path_tool.original_src.claws_tool.exposure_frame(exptable_row, target_ra, target_dec, siaf, nestable_row)

The main class to handle pointing info and rotation for an individual exposure

V2V3_at_one_attitude(radeg, decdeg, verbose=False)

Compute V2,V3 locations of stars at a given attitude

Parameters

radeg, decdeg: lists of floats

stellar coordinates in decimal degrees

Returns

v2,v3 positions in degrees

define_attitude(v3pa, usetarget=True)

Define an attitude matrix (pysiaf.rotations)

Parameters

v3pa:

position angle of the v3 axis

class jwst_rogue_path_tool.original_src.claws_tool.filter_info(filename='/path/to/future/data_dir/Filter_info.txt')

Get info on filter wavelengths and bandpass

get_info(pupilshort, filtershort, key_info='Pivot')
jwst_rogue_path_tool.original_src.claws_tool.get_pointing_info(header=None, visit_id=None)
class jwst_rogue_path_tool.original_src.claws_tool.observation(exptable_obs, nestable_obs, visittable_obs, target_ra, target_dec, modules, catargs, siaf, smallregion=False)

Class that handles an indivdual observation. It contains info on each exposure pointing configuration, retrieves a catalog within a certain annulus, and can check for stars in the susceptibility region

DN_report(attitudes, RP_padding=0.0, draw_reports=True, background_params=[{'func': <function min>, 'threshold': 0.1}], save_report_dir=None, save_figures_dir=None, verbose=False, smooth=None)

Method to call fixed_angle multiple times and get an estimated DN/pix/s for each filter in this observation, as a function of v3PA

Paramters

attitudes: numpy array

values of the attitudes at which one wants to compute the DN

background_params: list of dictionarie (can be None)

the claw flux is compared to threshold*func(background) where func is np.mean/np.min/np.max/np.median (or other callable that returns some summary stats), for each of the items of the list

check_multiple_angles(angstep, filtershort=None, RP_padding=0.0)

Convenience method to check multiple angles at once, for all exposures within this observation

Parameters

angstep: float

The resolution at which to scan the whole (0,360) range of PAs, in degrees

filtershort: string

name of the filter in use, will be used to downselect the exposures. if None will be defaulted to the first filter in the nircam_expsoures_specification table

RP_padding: float

Extra padding around the susceptibility region (stars outside the nominal SR, but within RP_padding are flagged as “inside”)

check_one_angle(att, filtershort, RP_padding=0.0)

Method to check for the presence of stars in the susceptibility region at a fixed angle, for all exposures of a given observation

Parameters

att: float

position angle to check, in degrees

filtershort: string

name of the filter in use, will be used to downselect the exposures

RP_padding: float

Extra padding around the susceptibility region (stars outside the nominal SR, but within RP_padding are flagged as “inside”)

Returns

IN_one: numpy boolean array (catalog size x number of SR region x number of exposures in the observation)

True values indicate stars that are in (one of) the SRs for one of the exposures

V2_one, V3one: numpy array (catalog size x number of exposures in the observation)

V2, V3 coordinates (jn deg) for a given stars and a given exposure

check_one: numpy boolean array (number of exposures in the observation)

True if any star is in either SRs for a given exposure

fixed_angle(att, RP_padding=0.0, smooth=None, draw_allexp=True, draw_summary=True, nrows=2, ncols=3, savefilenames=[None, None], metainfo=None)

Method to check a single angle and return diagnistic plot and info. Useful for checking executed observations.

Parameters

att: float

position angle to check, in degrees

RP_padding: float

Extra padding around the susceptibility region (stars outside the nominal SR, but within RP_padding are flagged as “inside”)

draw_allexp: boolean

flag to enable/disable plotting of the per-exposure results

draw_summary: boolean

flag to enable/disable plotting of the overall results

nrows, ncols: integers

number of rows and columns in the grid plot

savefilename: [file path,file path]

saves the figures to these location (first element for per-expsoure, second element for global plots). If None it doesn’t save one file

Returns

report_dict:

dictionary containing some metinfo and a pands dataframe with the True/False conditions for each stars for each exposure for each susceptibility region

get_SRlist()

Parameters

None

Returns

SRlist: list of matplotlib.Path objects

The list of susceptibility regions corresponding to the module used in this observation

get_catalog()

Parameters

None

Returns

df: Pandas dataframe

dataframe containing the coordinates of stars within an annulus centered on the observation target. The catalog characterisitics are based on the catargs dictionary

get_exposure_frames(siaf)

Parameters

siaf:

a pysiaf.Siaf instance

Returns

efs: list of exposure_frame objects

The list of objects containing pointing info for each exposure within this observation

plot_obs_field(bandpass)

Method to plot the stars in the catalog

Parameters

bandpass: string

bandpass to use for color-coding the stars

plot_observations_checks(nrows=2, ncols=3, verbose=True, filtershort=None)

Method to plot some summary results after running self.check_observations. It plots the claws-unaffected angles for each exposure and a summary of claws-unaffected angles over the whole observation

Parameters

nrows, ncols: integers

number of rows and columns in the grid plot

jwst_rogue_path_tool.original_src.claws_tool.querysimbad(ra, dec, rad=1, band='K', maxmag=6.0, simbad_timeout=200)
class jwst_rogue_path_tool.original_src.claws_tool.rogue_path_intensity(module='A', smooth=None)

Use the FITS files provided by Scott Rohrbach to get the intensity of the susceptibility zone at a given V2,V3

get_intensity(V2, V3)
class jwst_rogue_path_tool.original_src.claws_tool.sus_reg(module='A', small=False)
get_path()
class jwst_rogue_path_tool.original_src.claws_tool.zero_point_calc(filename='/path/to/future/datadir/NRC_ZPs_0995pmap.txt')

Get the average quantities (eg zp_vega og PHOTMJSR) over SCAs for a PUPIL+FILTER combo

get_avg_quantity(pupilshort, filtershort, quantity='PHOTMJSR')