### PyNOT Spectroscopic Pipeline -- Parameter File

dataset:                     # The PyNOT File Classification (*.pfc)

# [Workflow Manager]
# workflow:
#
# - bias:
#
# - flat:
#
# - arcs:
#
# - identify:
#
# - response:
#
# - science:


# [Recipe Options]
bias:
  kappa:  15                 # Threshold for sigma clipping in bias combiniation
  method: median             # Method for image combination (options: median/mean)

flat:
  kappa:          5          # Threshold for sigma clipping in Flat combiniation
  method:       mean         # Method for image combination (options: median/mean)
  order:          24         # Order for Chebyshev polynomial to fit to the spatial profile (per row/col)
  savgol_window:  51         # Window width in pixels for Savitzky--Golay filter of spatial profile
  med_window:     5          # Window width of median filter along spectral axis before fitting the spatial profile
  edge_threshold: 10         # The detection threshold for automatic edge detection
  edge_window:    21         # The Savitzky--Golay window used for automatic edge detection
  edge_width :    10         # The minimum width of peaks in the derivative for edge detection

identify:
  interactive: True          # Identify lines interactively using a graphical interface
  order_wl:    3             # Polynomial order used for wavelength fit as a function of input pixel
  all:         False         # Interactively reidentify arc reference frame for each target?
  loc:         -1            # Extract the 1D spectrum of the arc image at this column ID. If -1, use image midpoint.

rectify:
  order_bg:    5             # Polynomial order for background subtraction of calibration lamp continuum
  order_2d:    3             # Polynomial order for spatial reconstruction of arc lines
  log:         False         # Use logarithmic binning in wavelength?
  N_out:       null          # No. of output pixels along dispersion axis. If null is given, use No. of pixels in input image.
  interpolate: True          # Perform interpolation or apply central wavelength solution to full 2D range
  fit_window:  10            # Fitting window in pixels around each arc line to determine centroid  (optimized for grism 4)
  plot:        True          # Make diagnostic plots?
  edge_kappa:  10            # Significance threshold for edge detection of arc lines

crr:                         # Parameters of `astroscrappy.detect_cosmics`
  niter:       4             # Number of iterations for cosmic ray rejection  (turn off by setting niter = 0)
  gain:        null          # Detector gain, e-/ADU. Read from the header by default
  readnoise:   null          # Detector read-out noise, e-. Read from the header by default
  sigclip:     4.5           # Laplacian-to-noise limit for cosmic ray detection. Lower values will flag more pixels as cosmics
  sigfrac:     0.3           # Fractional detection limit for neighboring pixels
  objlim:      5.0           # Minimum contrast. Increase this value if cores of bright stars/skylines are flagged as cosmics
  cleantype:   'meanmask'    # Cleaning filter (5x5): {'median', 'medmask', 'meanmask', 'idw'}, see astroscrappy for details

skysub:
  auto:        True          # Automatically subtract the sky from the 2D spectrum?
  order_bg:    3             # Polynomial order for sky background subtraction (per row)
  kappa:       10            # Threshold for rejection of outlying pixels (cosmics etc) in units of std. deviations
  med_kernel:  15            # Median filter width for defining masking of cosmic rays, CCD artefacts etc.
  obj_kappa:   20            # Threshold for automatic object detection to be masked out.
  fwhm_scale:  3             # Mask out auto-identified objects within ±`fwhm_scale`*FWHM around centroid of object
  xmin:        0             # Mask out pixels below xmin
  xmax:        null          # Mask out pixels above xmax

extract:
  interactive:  False        # Extract the 1D spectrum using a graphical user interface?
  model_name:   'moffat'     # Profile type for optimal extraction 'moffat' or 'gaussian', otherwise 'tophat'
  dx:           25           # Fit the spectral trace for every `dx` pixels along dispersion axis
  width_scale:  2            # If model_name is 'tophat', this scales the width in terms of FWHM below and above the centroid
  xmin:         0            # Exclude pixels above this index for the fitting and object identification [dispersion axis]
  xmax:         null         # Exclude pixels below this index for the fitting and object identification [dispersion axis]
  ymin:         0            # Exclude pixels above this index for the fitting and object identification [spatial axis]
  ymax:         null         # Exclude pixels below this index for the fitting and object identification [spatial axis]
  order_center: 3            # Polynomial order used to fit the centroid along the spectral trace
  order_width:  0            # Polynomial order used to fit the width of the spectral trace
  w_cen:        15           # Kernel width of median filter for trace position
  kappa_cen:    3.0          # Threshold for median filtering. Reject outliers above: ±`kappa` * sigma
  w_width:      21           # Kernel width of median filter for trace width parameters
  kappa_width:  3.0          # Threshold for median filtering. Reject outliers above: ±`kappa` * sigma
  kappa_det:    10.          # Threshold for automatic object detection

response:
  order:        3            # Spline degree for smoothing the response function [1 ≤ order ≤ 5]
  smoothing:    0.02         # Smoothing scale of the spline interpolation.
  med_filter:   5            # Median filter width for removing outlying response points
  kappa:        2            # Threshold for the median filtering to remove outlying response points
  interactive:  False        # Interactively filter and fit the response function
  force:        False        # Overwrite existing response function?
