stops is a Python3-based pipeline designed to provide additional functionality to the polsalt pipeline.
This pipeline provides a command-line interface (CLI) that can call four main classes, each implementing a unique function: Split
, Join
, Skylines
, and CrossCorrelate
.
For an in-depth discussion and usage, see the stops writeup.
To install the stops pipeline, simply download the wheel file and run:
cd ~/Downloads
# Activate any conda environment
pip install STOPS
The repository may also be cloned and the dependencies installed:
git clone https://github.com/JustinotherGitter/STOPS.git # or manually download the repository
cd STOPS
# Additionally create and activate a python3 `STOPS` venv
pip install -r requirements.txt
Note: stops also requires ~/
, directory.
- Split: Separate the pre-processed polsalt FITS files by their perpendicular polarization beams into two iraf parsable FITS files.
- Join: Combine external wavelength calibration solutions with the perpendicular beams, as expected by polsalt's
spectral extraction
- Skylines: Automatically identify and calculate the difference between known and observed sky lines (or arc lines) in wavelength calibrated spectropolarimetric data.
- CrossCorrelate: Perform cross-correlation analysis on the spectropolarimetric data (possible after polsalt's
spectral extraction
), either for each file comparing the perpendicular polarization beams, or across multiple files comparing a singular polarization beam.
A simplistic workflow is provided below, for further information and implementation please see the [write-up] of stops.
- Pre-reductions may be performed on the raw data using polsalt, or downloaded directly alongside the raw data.
- The
$O$ - &$E$ -beams are split into two separate FITS files usingsplit
, into the format required by iraf. - Wavelength calibrations are performed via iraf, replacing the polsalt
wavelength calibration
.- Alternate external tools, such as Python may also be used for wavelength calibrations.
- Formatting of non-iraf wavelength solutions must be formatted as described in the Wavelength section.
- The
$O$ - &$E$ -beams, along with their respective wavelength solutions, are recombined into a single file usingjoin
, and cosmic-ray cleaning performed via thelacosmic
algorithm implemented throughccdproc
. - The wavelength calibrations for the
$O$ - &$E$ -beams may be compared usingskylines
, highlighting variations between the individual wavelength solutions. - Spectral extraction is performed via polsalt.
- The extracted spectra may be compared using
correlate
, allowing the correlation between the perpendicular polarization beams within a file to be correlated, or for a polarization beam across multiple files. - If either
skylines
orcorrelate
show poor wavelength calibrations, the wavelength calibration procedure may be repeated. - The files generated, excluding the wavelength solution, for wavelength calibrations may be moved or deleted.
- Polarization calculations are performed via polsalt.
- Flux calibration may be performed using the
astropy
andscipy
packages, assuming a standard is available for the observational setup.
Wavelength calibrations are ideally intended for iraf.
The iraf wavelength calibration procedure uses identify
, reidentify
, fitcoords
, and optionally transform
.
Any preferred parameters may be used during calibration with only the polynomial type of the resultant wavelength solution (as produced by fitcoords
) being limited to either Chebyshev
or Legendre
polynomials.
Alternate wavelength solutions may be used but must be:
- Saved in the working directory,
- Have separate files for the
$O$ - and$E$ -beams, - Have a name containing:
- The polynomial type (e.g.
cheb
for Chebyshev, orleg
for Legendre), and - The polarization beam contained within (e.g.
O
orE
),
- The polynomial type (e.g.
- Contain on:
- line 1 → the
$x$ -order of the 2D wavelength solution, - line 2 → the
$y$ -order of the 2D wavelength solution, - lines 3+ → the (
$x * y$ ) solution coefficients, in order, separated by line, and - all lines → no delimiters.
- line 1 → the
e.g.
cheb_params_e.txt
5
5
7419.096745914063
1510.03933621895
-21.10886852752348
-2.079553916887794
0.06772631420528228
0.7720164913117386
'...'
The stops pipeline is most generally controlled via a CLI. The basic format of commands follows:
<py_dir>python<3> <STOPS_dir>STOPS (General Options) [data_dir] MODE (Options) [File names]
where:
<>
parameters are optional depending on the system setup, e.g. if Python or stops has been added to$PATH
, etc. (for simplicity, these parameters will be left out of the usage examples below),MODE
refers to the operational mode of stops, as listed in Modes,()
parameters are optional, and[]
parameters are compulsory (unless otherwise stated).
Below are the details of the stops options, the available Modes, and their respective sub-options.
stops Options
Optional:
-V
,--version
: Show the version of stops.-v
,--verbose
: Enable and increase verbosity. Use-v
or-vv
for greater verbosity levels.-l
,--log
: Specify the filename of the logging file, which is created if it does not exist.
Compulsory:
data_dir
: The Path (absolute or relative) to the directory containing the Working data..
may be used to indicate the current directory that the CLI is running in.
For detailed information on stops, use the help command:
python STOPS . --help
Help for each mode is also accessible, and may be viewed using the help command:
python STOPS . MODE --help
where MODE
may be replaced with split
, join
, skylines
, or crosscorrelate
.
python STOPS . split (Options) [mxgbp*.fits]
Optional:
-
-n
,--no_arc
: Exclude arc files from processing. -
-s
,--split_row
: Row along which the$O$ - &$E$ -beams are split. Defaults to the polsalt's default. -
-p
,--save_prefix
: Prefix appended to the filenames for saving the$O$ - &$E$ -beams. Defaults to the polsalt's default.
Compulsory:
- Filenames to be split. May be excluded if the RegEx pattern in the example matches the desired files.
python STOPS . join (Options) []
Optional:
-
-n
,--no_arc
: Exclude arc files from processing. -
-s
,--split_row
: Row along which the$O$ - &$E$ -beams are split. Defaults to the pipeline's default. -
-p
,--save_prefix
: Prefix appended to the filenames for saving the$O$ - &$E$ -beams. Defaults to the pipeline's default. -
-c
,--coefficients
: Custom coefficients to use instead of theIRAF
fitcoords database. Use as-c <o_solution> <e_solution>
or a RegEx descriptor-c <*solution*extension>
.
Compulsory:
- May be excluded as
join
will identify all split files and wavelength solution database entries to recombine.
python STOPS . skylines (Options) [Filenames]
Optional:
-b
,--beams
: Beams to process. Defaults toOE
, but may be givenO
,E
, orOE
.-ccd
,--split_ccd
: Flag to NOT split CCD's.-c
,--continuum_order
: Order of continuum to remove from spectra.-p
,--plot
: Flag for additional debug plot outputs.-s
,--save_prefix
: Prefix used when saving plot.-t
,--transform
: Force transform images, for iraftransform
FITS file debugging.
Compulsory:
- Filenames to be considered for
skyline
comparisons. May either be:
python STOPS . correlate (Options) [ecwmxgbp*.fits]
Optional:
-b
,--beams
: Beams to process. Defaults toOE
, but may be givenO
,E
, orOE
.-ccd
,--split_ccd
: Flag to NOT split CCD's.-c
,--continuum_order
: Order of continuum to remove from spectra.-p
,--plot
: Flag for additional debug plot outputs.-s
,--save_prefix
: Prefix used when saving plot.-o
,--offset
: Introduce an offset when correcting for known offset in spectra or for testing purposes. Deprecated keyword.
Compulsory:
- Filenames to be considered for
correlate
cross-correlation. May be excluded if the RegEx pattern in the example matches the desired files.
Contributions are welcome! Please fork the repository and create a pull request with your changes. The following styles are broadly implemented, and serve as a collection of references used when creating the stops pipeline:
-
General Python project structure applies
-
Docstrings follow the NumPy documentation style
- Possible
sphinx
docs?
- Possible
-
Classes and methods implement typing for type hinting
-
Logging is implemented
-
Tests are planned but not implemented
pytest
orunittest
(pytest-cov
|tox
)?
-
requirements.txt was generated using
pipreqs
-
Found using:
cd /media/justin/Transcend/STOPS pipreqs
-
-
The minimum required Python version was found using
vermin
-
Found using:
cd /media/justin/Transcend/STOPS vermin --eval-annotations --feature union-types ./src/STOPS
-
-
stops management
-
Building generates
tar.gz
andwhl
files, overwrites if version not updated. Built using:cd /media/justin/Transcend/STOPS python3 -m build
-
Installed using
pip
in an editable format (exclude-e
forstable
release):cd /media/justin/Transcend/STOPS pip install -e ../STOPS
-
-
Package creation:
-
Package resources
-
SALT Line Atlases
This project is licensed under the BSD 3-Clause License. See the LICENSE for further details.