pypeit.scripts.fit_ramp module

Preprocess up-the-ramp cubes into 2D count-rate images.

Given a PypeIt Reduction File, each multi-read raw cube it lists is fit up the ramp (with jump detection; see pypeit.ext.fitramp.fitramp) and the result is written to the ramp-fit directory inside the reduction directory (the [rdx] redux_path and rampfit_dir parameters), named after the raw cube with a _rampfit marker before the extension. run_pypeit finds and reuses these files automatically — and creates them itself when missing — so running this script is optional; it lets users inspect the fitted images (units of e-/s) before a full reduction and front-loads the fitting cost. The intended workflow is:

pypeit_setup ...
pypeit_fit_ramp blah.pypeit   # optional
run_pypeit blah.pypeit

Because the script reads the same pypeit file as the reduction, it uses the same reduction directory, ramp-fit directory, and dark frames (for the per-read noise calibration) automatically.

Only spectrographs read out up-the-ramp (currently MMT/MMIRS) implement the required interface; any other spectrograph raises an error.

class pypeit.scripts.fit_ramp.FitRamp[source]

Bases: ScriptBase

classmethod get_parser(width=None)[source]

Construct the command-line argument parser.

Derived classes should override this. Ideally they should use this base-class method to instantiate the ArgumentParser object and then fill in the relevant parser arguments

Warning

Any argument that defaults to the string 'current working directory' will be replaced by the result of Path.cwd() when the script is executed. This means help dialogs will include this replacement, and parsing of the command line will use Path.cwd() as the default. This functionality is largely to allow for PypeIt’s automated documentation of script help dialogs without the “current working” directory being that of the developer that most recently compiled the docs.

Parameters:
  • description (str, optional) – A short description of the purpose of the script.

  • width (int, optional) – Restrict the width of the formatted help output to be no longer than this number of characters, if possible given the help formatter. If None, the width is the same as the terminal width.

  • formatter (argparse.HelpFormatter) – Class used to format the help output.

  • include_log_options (bool, optional) – Include options that define the logging level(s) and log file.

  • default_log_file (bool, optional) – If true, script will use the default log file name if none is provided. Ignored if include_log_options is False.

Returns:

Command-line interpreter.

Return type:

argparse.ArgumentParser

classmethod main(args)[source]

Execute the script.

Return type:

None