abscal.wfc3.preprocess_table_create

This module takes a file path and file type specification that matches to one or more WFC3 exposures. In general, these files should be observations of WFC3 standard stars. The module will open these files, retrieve information from their headers, and produce an output table of these files.

For compatibility with the original program, the module can be run from the command line directly (and given a file specification as a positional argument). In that case, it will work exactly the same as ‘wfcdir.pro’ as created by Ralph Bohlin. It also includes additional options that allow the output file name to be specified, allow the stdout content (and verbosity) to be specified, and allow multiple input directories to be specified with the positional argument acting as a template for files to search for rather than as the full search path.

Authors

  • Brian York (all python code)

  • Ralph Bohlin (original IDL code)

Use

This module is intended to be either run from the command line or used by other module code as the first step (creating an annotated list of files for flux calibration):

python preprocess_table_create.py

Alternately there are a set of python scripts placed in your path by setup.py that will import and call this module. The general command is:

wfc3_setup

whilst the IDL version is:

wfcdir

If you use this module from within python, it is recommended to import the populate_table() function (if you need any custom table values, you can either pass in an AbscalDataTable directly or pass in keyword parameters that will, in turn, be passed along to the table creation):

from abscal.wfc3 import populate_table

output_table = populate_table(some_arguments=some_values)

Module Contents

Functions

get_target_name(header)

Find the canonical target name.

populate_table([data_table])

Search a directory and produce a table of exposures.

additional_args(**kwargs)

Adds process-specific command-line arguments.

parse_args(**kwargs)

Parse command-line arguments.

main(**kwargs)

Run the process.

abscal.wfc3.preprocess_table_create.get_target_name(header)

Find the canonical target name.

Return a standardized target name despite any inconsistencies in target naming by different PIs. For now, use the existing wfcdir.pro checks to make a standard target name. In the future, potentially use RA and DEC to do a lookup to figure out the target and fill in appropriately.

Parameters:

header (astropy.io.fits header) –

The header containing target information. In this header, the keys

  • targname (target name)

  • ra_targ (target RA)

  • dec_targ (target DEC)

  • sclamp (active lamp)

are (or may be) used by the function.

Returns:

name – Target name, standardized.

Return type:

str

abscal.wfc3.preprocess_table_create.populate_table(data_table=None, **kwargs)

Search a directory and produce a table of exposures.

Uses glob to search all directories in the table’s search_dirs array for files matching the table’s search_str template, and adds rows to the table containing metadata based on the files that were found.

Parameters:
  • data_table (abscal.common.exposure_data_table.AbscalDataTable, default None) – The table (which may contain existing data) to which the new data should be added.

  • kwargs (dict) –

    A dictionary of optional keywords. Currently checked keywords are:

    verbosebool

    Flag to indicate whether or not the program should print out informative text whilst running.

    compatbool

    Whether to operate in strict IDL compatibility mode

    In addition to these keywords, any default parameters may be set through passing a keyword argument.

  • None (If data_table is) –

  • case (a new table will be created in the function. In that) –

  • the

  • table (kwargs dict will be passed to that) –

  • sent (so any table-creation keywords will be) –

  • through.

Returns:

data_table – A table containing an entry for each input file and necessary metadata obtained from the FITS header of that file.

Return type:

abscal.common.exposure_data_table.AbscalDataTable

abscal.wfc3.preprocess_table_create.additional_args(**kwargs)

Adds process-specific command-line arguments.

This function generates arguments (in a form understandable by abscal.common.args.parse) to handle items unique to table creation.

  • How duplicate entries should be handled (important because this is process is the one that adds new entries to a table)

  • The search template

Returns:

args – Dictionary of tuples of arguments for building a module command-line argument list.

Return type:

dict

abscal.wfc3.preprocess_table_create.parse_args(**kwargs)

Parse command-line arguments.

Returns:

res – A namespace populated by the command-line arguments.

Return type:

namespace

abscal.wfc3.preprocess_table_create.main(**kwargs)

Run the process.

This function is called if the script is run directly (i.e. __name__ == “__main__”), and is also imported by the binary command scripts as a way to run this process as a standalone application.

Parameters:

kwargs (dict) – Contains keys named after keyword parameters (whether command-line arguments or parameters used by table creation) that will override whatever value is set there. Note that specific exposure-specific values from data files will still override values specified here.