pypeit.par.pypeitpar module

Defines parameter sets used to set the behavior for core pypeit functionality.

For more details on the full parameter hierarchy and a tabulated description of the keywords in each parameter set, see User-level Parameters.

For examples of how to change the parameters for a run of pypeit using the pypeit input file, see PypeIt Reduction File.

New Parameters:

To add a new parameter, let’s call it foo, to any of the provided parameter sets:

  • Add foo=None to the __init__ method of the relevant parameter set. E.g.:

    def __init__(self, existing_par=None, foo=None):
    
  • Add any default value (the default value is None unless you set it), options list, data type, and description to the body of the __init__ method. E.g.:

    defaults['foo'] = 'bar'
    options['foo'] = [ 'bar', 'boo', 'fighters' ]
    dtypes['foo'] = str
    descr['foo'] = 'foo? who you callin a foo!  '                        'Options are: {0}'.format(', '.join(options['foo']))
    
  • Add the parameter to the from_dict method:

    • If the parameter is something that does not require instantiation, add the keyword to the parkeys list in the from_dict method. E.g.:

      parkeys = [ 'existing_par', 'foo' ]
      kwargs = {}
      for pk in parkeys:
          kwargs[pk] = cfg[pk] if pk in k else None
      
    • If the parameter is another ParSet or requires instantiation, provide the instantiation. For example, see how the ProcessImagesPar parameter set is defined in the FrameGroupPar class. E.g.:

      pk = 'foo'
      kwargs[pk] = FooPar.from_dict(cfg[pk]) if pk in k else None
      

New Parameter Sets:

To add an entirely new parameter set, use one of the existing parameter sets as a template, then add the parameter set to PypeItPar, assuming you want it to be accessed throughout the code.

class pypeit.par.pypeitpar.AlignPar(locations=None, trace_npoly=None, trim_edge=None, snr_thresh=None)[source]

Bases: ParSet

The parameter set used to hold arguments for tracing the alignments in an align frame.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.CalibrationsPar(calib_dir=None, bpm_usebias=None, biasframe=None, darkframe=None, arcframe=None, tiltframe=None, pixelflatframe=None, pinholeframe=None, alignframe=None, alignment=None, traceframe=None, illumflatframe=None, lampoffflatsframe=None, scattlightframe=None, skyframe=None, standardframe=None, scattlight_pad=None, flatfield=None, wavelengths=None, slitedges=None, tilts=None, raise_chk_error=None)[source]

Bases: ParSet

The superset of parameters used to calibrate the science data.

Note that there are specific defaults for each frame group that are different from the defaults of the abstracted FrameGroupPar class.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

class pypeit.par.pypeitpar.Coadd1DPar(ex_value=None, flux_value=None, nmaskedge=None, sn_smooth_npix=None, sigrej_exp=None, wave_method=None, dv=None, dwave=None, dloglam=None, wave_grid_min=None, wave_grid_max=None, spec_samp_fact=None, ref_percentile=None, maxiter_scale=None, sigrej_scale=None, scale_method=None, sn_min_medscale=None, sn_min_polyscale=None, weight_method=None, maxiter_reject=None, lower=None, upper=None, maxrej=None, sn_clip=None, nbests=None, coaddfile=None, mag_type=None, filter=None, filter_mag=None, filter_mask=None)[source]

Bases: ParSet

A parameter set holding the arguments for how to perform 1D coadds

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_ex()[source]

Return the valid flat-field methods

static valid_scale_methods()[source]

Return the valid options for the scaling of spectra.

static valid_wave_methods()[source]

Return the valid options for the wavelength grid of spectra.

static valid_weight_methods()[source]

Return the valid options for the weighting of spectra.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.Coadd2DPar(only_slits=None, exclude_slits=None, offsets=None, spat_toler=None, weights=None, user_obj=None, use_slits4wvgrid=None, manual=None, wave_method=None)[source]

Bases: ParSet

A parameter set holding the arguments for how to perform 2D coadds

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.Collate1DPar(tolerance=None, dry_run=None, ignore_flux=None, flux=None, match_using=None, exclude_slit_trace_bm=[], exclude_serendip=False, wv_rms_thresh=None, outdir=None, spec1d_outdir=None, refframe=None)[source]

Bases: ParSet

A parameter set holding the arguments for collating, coadding, and archving 1d spectra.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.CubePar(slit_spec=None, weight_method=None, align=None, combine=None, output_filename=None, standard_cube=None, reference_image=None, save_whitelight=None, whitelight_range=None, method=None, ra_min=None, ra_max=None, dec_min=None, dec_max=None, wave_min=None, wave_max=None, spatial_delta=None, wave_delta=None, astrometric=None, grating_corr=None, scale_corr=None, skysub_frame=None, spec_subpixel=None, spat_subpixel=None, slice_subpixel=None, correct_dar=None)[source]

Bases: ParSet

The parameter set used to hold arguments for functionality relevant to cube generation (primarily for IFU data).

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.EdgeTracePar(filt_iter=None, sobel_mode=None, edge_thresh=None, sobel_enhance=None, exclude_regions=None, follow_span=None, det_min_spec_length=None, trim_spec=None, max_shift_abs=None, max_shift_adj=None, max_spat_error=None, match_tol=None, fit_function=None, fit_order=None, fit_maxdev=None, fit_maxiter=None, fit_niter=None, fit_min_spec_length=None, auto_pca=None, left_right_pca=None, pca_min_edges=None, pca_n=None, pca_var_percent=None, pca_function=None, pca_order=None, pca_sigrej=None, pca_maxrej=None, pca_maxiter=None, smash_range=None, edge_detect_clip=None, trace_median_frac=None, trace_thresh=None, trace_rms_tol=None, fwhm_uniform=None, niter_uniform=None, fwhm_gaussian=None, niter_gaussian=None, det_buffer=None, max_nudge=None, sync_predict=None, sync_center=None, gap_offset=None, sync_to_edge=None, bound_detector=None, minimum_slit_dlength=None, dlength_range=None, minimum_slit_length=None, minimum_slit_length_sci=None, length_range=None, minimum_slit_gap=None, clip=None, order_match=None, order_offset=None, add_missed_orders=None, order_width_poly=None, order_gap_poly=None, order_spat_range=None, overlap=None, use_maskdesign=None, maskdesign_maxsep=None, maskdesign_step=None, maskdesign_sigrej=None, pad=None, add_slits=None, add_predict=None, rm_slits=None, maskdesign_filename=None)[source]

Bases: ParSet

Parameters used for slit edge tracing.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

prefix = 'ETP'

Class Prefix for header keywords when writing the parset to an astropy.io.fits.Header object.

static valid_center_modes()[source]

Return the valid center prediction modes.

static valid_functions()[source]

Return the list of valid functions to use for slit tracing.

static valid_predict_modes()[source]

Return the valid trace prediction modes.

static valid_sobel_modes()[source]

Return the valid sobel modes.

validate()[source]

Validate the parameter set.

class pypeit.par.pypeitpar.ExtractionPar(boxcar_radius=None, std_prof_nsigma=None, sn_gauss=None, model_full_slit=None, skip_extraction=None, skip_optimal=None, use_2dmodel_mask=None, use_user_fwhm=None, return_negative=None)[source]

Bases: ParSet

The parameter set used to hold arguments for functionality relevant to extraction.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.FindObjPar(trace_npoly=None, snr_thresh=None, find_trim_edge=None, find_maxdev=None, find_extrap_npoly=None, maxnumber_sci=None, maxnumber_std=None, find_fwhm=None, ech_find_max_snr=None, ech_find_min_snr=None, ech_find_nabove_min_snr=None, skip_second_find=None, skip_final_global=None, skip_skysub=None, find_negative=None, find_min_max=None, std_spec1d=None, fof_link=None)[source]

Bases: ParSet

The parameter set used to hold arguments for functionality relevant to finding and tracing objects.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.FlatFieldPar(method=None, pixelflat_file=None, spec_samp_fine=None, spec_samp_coarse=None, spat_samp=None, tweak_slits=None, tweak_slits_thresh=None, tweak_slits_maxfrac=None, rej_sticky=None, slit_trim=None, slit_illum_pad=None, illum_iter=None, illum_rej=None, twod_fit_npoly=None, saturated_slits=None, slit_illum_relative=None, slit_illum_ref_idx=None, slit_illum_smooth_npix=None, pixelflat_min_wave=None, pixelflat_max_wave=None, slit_illum_finecorr=None, fit_2d_det_response=None)[source]

Bases: ParSet

A parameter set holding the arguments for how to perform the field flattening.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_methods()[source]

Return the valid flat-field methods

static valid_saturated_slits_methods()[source]

Return the valid options for dealing with saturated slits.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.FlexurePar(spec_method=None, spec_maxshift=None, spectrum=None, multi_min_SN=None, excessive_shift=None, minwave=None, maxwave=None)[source]

Bases: ParSet

A parameter set holding the arguments for how to perform flexure corrections, both spatial and spectral

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_excessive_shift_methods()[source]

Return the valid options for dealing with excessive flexure shift.

static valid_methods()[source]

Return the valid flat-field methods

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.FluxCalibratePar(extinct_correct=None, extinct_file=None, extrap_sens=None, use_archived_sens=False)[source]

Bases: ParSet

A parameter set holding the arguments for how to perform the flux calibration.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.FrameGroupPar(frametype=None, useframe=None, exprng=None, process=None)[source]

Bases: ParSet

An abstracted group of parameters that defines how specific types of frames should be grouped and combined.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(frametype, cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_frame_types()[source]

Return the list of valid frame types.

validate()[source]
class pypeit.par.pypeitpar.ProcessImagesPar(trim=None, apply_gain=None, orient=None, overscan_method=None, overscan_par=None, combine=None, satpix=None, mask_cr=None, clip=None, n_lohi=None, lamaxiter=None, grow=None, comb_sigrej=None, rmcompact=None, sigclip=None, sigfrac=None, objlim=None, use_biasimage=None, use_overscan=None, use_darkimage=None, dark_expscale=None, empirical_rn=None, shot_noise=None, noise_floor=None, use_pixelflat=None, use_illumflat=None, use_specillum=None, use_pattern=None, subtract_scattlight=None, scattlight=None, subtract_continuum=None, spat_flexure_correct=None, spat_flexure_maxlag=None)[source]

Bases: ParSet

The parameters needed to perform basic image processing.

These parameters are primarily used by buildimage_fromlist(), the main function used to process and combine images.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

classmethod from_header(hdr)[source]

Instantiate the object from parameters read from a fits header.

to_header(hdr)[source]

Write the parameters to a header object.

static valid_combine_methods()[source]

Return the valid methods for combining frames.

static valid_overscan_methods()[source]

Return the valid overscan methods.

static valid_saturation_handling()[source]

Return the valid approachs to handling saturated pixels.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.PypeItPar(rdx=None, calibrations=None, scienceframe=None, reduce=None, flexure=None, fluxcalib=None, coadd1d=None, coadd2d=None, sensfunc=None, telluric=None, collate1d=None)[source]

Bases: ParSet

The superset of parameters used by PypeIt.

This is a single object used as a container for all the user-specified arguments used by PypeIt.

To get the default parameters for a given spectrograph, e.g.:

from pypeit.spectrographs.util import load_spectrograph

spectrograph = load_spectrograph('shane_kast_blue')
par = spectrograph.default_pypeit_par()

If the user has a set of configuration alterations to be read from a pypeit file, e.g.:

from pypeit.par.util import parse_pypeit_file
from pypeit.spectrographs.util import load_spectrograph
from pypeit.par import PypeItPar

spectrograph = load_spectrograph('shane_kast_blue')
spec_cfg_lines = spectrograph.default_pypeit_par().to_config()
user_cfg_lines = parse_pypeit_file('myrdx.pypeit')[0]
par = PypeItPar.from_cfg_lines(cfg_lines=spec_cfg_lines,
                              merge_with=user_cfg_lines)

To write the configuration of a given instance of PypeItPar, use the to_config() function:

par.to_config('mypypeitpar.cfg')

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_cfg_file(cfg_file=None, merge_with=None, evaluate=True)[source]

Construct the parameter set using a configuration file.

Note that:

default = PypeItPar()
nofile = PypeItPar.from_cfg_file()
assert default.data == nofile.data, 'This should always pass.'
Parameters:
  • cfg_file (str, optional) – The name of the configuration file that defines the default parameters. This can be used to load a pypeit config file from a previous run that was constructed and output by pypeit. This has to contain the full set of parameters, not just the subset you want to change. For the latter, use merge_with to provide one or more config files to merge with the defaults to construct the full parameter set.

  • merge_with (str, list, optional) – One or more config files with the modifications to either default parameters (cfg_file is None) or the parameters provided by cfg_file. The modifications are performed in series so the list order of the config files is important.

  • evaluate (bool, optional) – Evaluate the values in the config object before assigning them in the subsequent parameter sets. The parameters in the config file are always read as strings, so this should almost always be true; however, see the warning below.

Warning

When evaluate is true, the function runs eval() on all the entries in the ConfigObj dictionary, done using recursive_dict_evaluate(). This has the potential to go haywire if the name of a parameter unintentionally happens to be identical to an imported or system-level function. Of course, this can be useful by allowing one to define the function to use as a parameter, but it also means one has to be careful with the values that the parameters should be allowed to have. The current way around this is to provide a list of strings that should be ignored during the evaluation, done using _eval_ignore().

Todo

Allow the user to add to the ignored strings.

Returns:

The instance of the parameter set.

Return type:

PypeItPar

classmethod from_cfg_lines(cfg_lines=None, merge_with=None, evaluate=True)[source]

Construct the parameter set using the list of string lines read from a config file.

Note that:

default = PypeItPar()
nofile = PypeItPar.from_cfg_lines()
assert default.data == nofile.data, 'This should always pass.'
Parameters:
  • cfg_lines (list, optional) – A list of strings with lines read, or made to look like they are, from a configuration file. This can be used to load lines from a previous run of pypeit that was constructed and output by pypeit. This has to contain the full set of parameters, not just the subset to change. For the latter, leave this as the default value (None) and use merge_with to provide a set of lines to merge with the defaults to construct the full parameter set.

  • merge_with (tuple or list, optional) – A tuple containing one more lists of strings with lines read, or made to look like they are, from a configuration file that should be merged with the lines provided by cfg_lines, or the default parameters. The order of the lists in the tuple is important, as it sets the order in which the lines are merged. Last in line has highest priority. Or the input may be a list which will be taken as a single item described above.

  • evaluate (bool, optional) – Evaluate the values in the config object before assigning them in the subsequent parameter sets. The parameters in the config file are always read as strings, so this should almost always be true; however, see the warning below.

Warning

When evaluate is true, the function runs eval() on all the entries in the ConfigObj dictionary, done using recursive_dict_evaluate(). This has the potential to go haywire if the name of a parameter unintentionally happens to be identical to an imported or system-level function. Of course, this can be useful by allowing one to define the function to use as a parameter, but it also means one has to be careful with the values that the parameters should be allowed to have. The current way around this is to provide a list of strings that should be ignored during the evaluation, done using _eval_ignore().

Todo

Allow the user to add to the ignored strings.

Returns:

The instance of the parameter set.

Return type:

PypeItPar

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

reset_all_processimages_par(**kwargs)[source]

Change image processing parameter for all frame types.

This function iteratively changes the value of all image processing parameters for all frame types in the CalibrationsPar, as well as the science frames.

Parameters:

**kwargs – The list of keywords and values to change for all image processing parameters.

Examples

To turn off the slit-illumination correction for all frames:

>>> from pypeit.spectrographs.util import load_spectrograph
>>> spec = load_spectrograph('shane_kast_blue')
>>> par = spec.default_pypeit_par()
>>> par.reset_all_processimages_par(use_illumflat=False)
sync_processing(proc_par)[source]

Sync the processing of all the frame types based on the input ProcessImagesPar parameters.

The parameters are merged in sequence starting from the parameter defaults, then including global adjustments provided by process, and ending with the parameters that may have already been changed for each frame.

This function can be used at anytime, but is most useful with the from_dict method where a baseprocess group can be supplied to change the processing parameters for all frames away from the defaults.

Parameters:

proc_par (ProcessImagesPar) – Effectively a new set of default image processing parameters for all frames.

Raises:

TypeError – Raised if the provided parameter set is not an instance of ProcessImagesPar.

validate()[source]
class pypeit.par.pypeitpar.ReducePar(findobj=None, skysub=None, extraction=None, cube=None, trim_edge=None, slitmask=None)[source]

Bases: ParSet

The parameter set used to hold arguments for sky subtraction, object finding and extraction in the Reduce class

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.ReduxPar(spectrograph=None, detnum=None, sortroot=None, calwin=None, scidir=None, qadir=None, redux_path=None, ignore_bad_headers=None, slitspatnum=None, maskIDs=None, quicklook=None, chk_version=None)[source]

Bases: ParSet

The parameter set used to hold arguments for functionality relevant to the overal reduction of the the data.

Critically, this parameter set defines the spectrograph that was used to collect the data and the overall pipeline used in the reductions.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.ScatteredLightPar(method=None, finecorr_method=None, finecorr_pad=None, finecorr_order=None, finecorr_mask=None)[source]

Bases: ParSet

The parameter set used to hold arguments for modelling the scattered light.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_finecorr_scattlight_methods()[source]

Return the valid scattered light methods.

static valid_scattlight_methods()[source]

Return the valid scattered light methods.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.SensFuncPar(flatfile=None, extrap_blu=None, extrap_red=None, samp_fact=None, multi_spec_det=None, algorithm=None, UVIS=None, IR=None, polyorder=None, star_type=None, star_mag=None, star_ra=None, star_dec=None, mask_hydrogen_lines=None, mask_helium_lines=None, hydrogen_mask_wid=None)[source]

Bases: ParSet

A parameter set holding the arguments for sensitivity function computation using the UV algorithm, see sensfunc.SensFuncUV

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_algorithms()[source]

Return the valid sensitivity algorithms.

class pypeit.par.pypeitpar.SensfuncUVISPar(std_file=None, std_obj_id=None, sensfunc=None, extinct_correct=None, extinct_file=None, telluric_correct=None, telluric=None, polycorrect=None, polyfunc=None, nresln=None, resolution=None, trans_thresh=None)[source]

Bases: ParSet

A parameter set holding the arguments for sensitivity function computation using the UV algorithm, see sensfunc.SensFuncUV

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.SkySubPar(bspline_spacing=None, sky_sigrej=None, global_sky_std=None, no_poly=None, user_regions=None, joint_fit=None, mask_by_boxcar=None, no_local_sky=None, max_mask_frac=None, local_maskwidth=None)[source]

Bases: ParSet

The parameter set used to hold arguments for functionality relevant to sky subtraction.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.SlitMaskPar(obj_toler=None, assign_obj=None, snr_thrshd=None, slitmask_offset=None, use_dither_offset=None, bright_maskdef_id=None, extract_missing_objs=None, missing_objs_fwhm=None, missing_objs_boxcar_rad=None, use_alignbox=None)[source]

Bases: ParSet

A parameter set holding the arguments for fussing with slitmask ingestion and object assignment

A list of these objects can be included in an instance of SlitMaskPar to perform a set of user-defined extractions.

Args:

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.TelescopePar(name=None, longitude=None, latitude=None, elevation=None, fratio=None, diameter=None, eff_aperture=None)[source]

Bases: ParSet

The parameters used to define the salient properties of a telescope.

These parameters should be independent of any specific use of the telescope. They and are used by the pypeit.telescopes module to define the telescopes served by PypeIt, and kept as part of the pypeit.spectrographs.spectrograph.Spectrograph definition of the instruments served by PypeIt.

To see the list of instruments served, a table with the the current keywords, defaults, and descriptions for the TelescopePar class, and an explanation of how to define a new instrument, see Spectrographs.

eff_aperture()[source]
classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

platescale()[source]

Return the platescale of the telescope in arcsec per mm.

Calculated as

\[p = \frac{206265}{f D},\]

where \(f\) is the f-ratio and \(D\) is the diameter. If either of these is not available, the function returns None.

static valid_telescopes()[source]

Return the valid telescopes.

validate()[source]
class pypeit.par.pypeitpar.TelluricPar(telgridfile=None, sn_clip=None, resln_guess=None, resln_frac_bounds=None, pix_shift_bounds=None, delta_coeff_bounds=None, minmax_coeff_bounds=None, maxiter=None, tell_npca=None, teltype=None, sticky=None, lower=None, upper=None, seed=None, tol=None, popsize=None, recombination=None, polish=None, disp=None, objmodel=None, redshift=None, delta_redshift=None, pca_file=None, npca=None, bal_wv_min_max=None, bounds_norm=None, tell_norm_thresh=None, only_orders=None, pca_lower=None, pca_upper=None, star_type=None, star_mag=None, star_ra=None, star_dec=None, func=None, model=None, polyorder=None, fit_wv_min_max=None, mask_lyman_a=None)[source]

Bases: ParSet

A parameter set holding the arguments for sensitivity function computation using the UV algorithm, see sensfunc.SensFuncUV

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_teltype()[source]

Return the valid telluric methods.

validate()[source]

Check the parameters are valid for the provided method.

class pypeit.par.pypeitpar.WaveTiltsPar(idsonly=None, tracethresh=None, sig_neigh=None, nfwhm_neigh=None, maxdev_tracefit=None, sigrej_trace=None, spat_order=None, spec_order=None, func2d=None, maxdev2d=None, sigrej2d=None, rm_continuum=None, cont_rej=None, minmax_extrap=None)[source]

Bases: ParSet

The parameter set used to hold arguments for tracing the monochromatic tilt along the slit.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

Todo

Changed to reflect wavetilts.py settings. Was yorder previously disporder? If so, I think I prefer the generality of disporder

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

validate()[source]
class pypeit.par.pypeitpar.WavelengthSolutionPar(reference=None, method=None, echelle=None, ech_nspec_coeff=None, ech_norder_coeff=None, ech_sigrej=None, lamps=None, bad_orders_maxfrac=None, frac_rms_thresh=None, sigdetect=None, fwhm=None, fwhm_fromlines=None, fwhm_spat_order=None, fwhm_spec_order=None, reid_arxiv=None, nreid_min=None, reid_cont_sub=None, cc_shift_range=None, cc_thresh=None, cc_local_thresh=None, nlocal_cc=None, rms_thresh_frac_fwhm=None, match_toler=None, func=None, n_first=None, n_final=None, sigrej_first=None, sigrej_final=None, numsearch=None, nfitpix=None, refframe=None, nsnippet=None, use_instr_flag=None, wvrng_arxiv=None, ech_2dfit=None, ech_separate_2d=None, redo_slits=None, qa_log=None, cc_percent_ceil=None, echelle_pad=None, cc_offset_minmax=None, stretch_func=None)[source]

Bases: ParSet

The parameter set used to hold arguments for the determination of wavelength solution.

For a table with the current keywords, defaults, and descriptions, see User-level Parameters.

classmethod from_dict(cfg)[source]

Instantiate a ParSet from a dictionary.

This simply constructs a ParSet that behaves exactly like a dictionary. That is, no constraints are put on the types, options, etc., of the parameters.

Warning

Use of this method of instantiating a ParSet only sets the parameter keys and values, not its other attributes (e.g., options, dtypes, etc). In essentially all use cases, the ParSet should be used as a base class where the from_dict() method is overwritten such that these higher-level attributes of the derived class are maintained in the header I/O. See, e.g., pypeit.par.pypeitpar.

Parameters:

cfg (dict-like) – Dictionary-like object used to set the parameters and parameter values for the ParSet.

static valid_lamps()[source]

Return the valid lamp ions

static valid_media()[source]

Return the valid media for the wavelength calibration.

static valid_methods()[source]

Return the valid wavelength solution methods.

static valid_reference()[source]

Return the valid wavelength solution methods.

static valid_reference_frames()[source]

Return the valid reference frames for the wavelength calibration

static valid_stretch_func_methods()[source]

Return the valid options for the stretch_func methods.

validate()[source]
pypeit.par.pypeitpar.tuple_force(par)[source]

Cast object as tuple.

Parameters:

par (object) – Object to cast as a tuple. Can be None; if so, the returned value is also None (not an empty tuple). If this is already a tuple, this is the returned value. If the input is a list with one tuple, the returned value is just the single tuple in the list (i.e, this does not convert the result to a tuple of one tuple).

Returns:

Casted result.

Return type:

tuple