Command Line Interface¶
Here, we describe how to use the command-line interface for specmatch-emp
.
Installation¶
The command-line hooks are generated when you install specmatch-emp
. Run
the installation script to get this to work.
$ python setup.py install
Specmatch¶
To run the full specmatch algorithm on a target spectrum, use the smemp specmatch
command. The full signature is:
$ smemp specmatch [-o OUTDIR] [-p] [-n NUM_BEST] [-s SUFFIX] [i LIB_NAME] spectrum
- spectrum
- The full path to the target spectrum.
Options¶
- -o <outdir>
- Specifies the directory to place the output files. If no directory is specified, output files are placed in the current directory.
- -p
- Set this flag to generate plots.
-p
generates a set of representative plots for the shifting, matching, and linear combination processes, using the results from order 2.-pp
generates the above plots, but for every order used. - -n <num_best>
- Sets the number of best-matching spectra to use in the linear combination process. Defaults to 5.
- -s <suffix>
- Suffix to append to output file names.
- -i <lib_name>
- Excludes the spectrum with the given name in the library, from the specmatch algorithm. Meant for validation purposes.
- –n_lib_subset <n>
- Run SpecMatch-Emp with only n random stars (default = 25). Useful for debugging purposes.
Shift¶
This command runs only the shifting part of the code, placing the target spectrum onto the library (NSO) wavelength scale.
$ smemp shift [-d DIRECTORY] [-o OUTDIR] [-f] [-nb] [-p] [-s SUFFIX] spectrum
- spectrum
- Either the full path to the target spectrum, or a CPS id (jXX.XXXX), where the
-d
option specifies the directory to look for the file. If a CPS id is provided, SpecMatch-Emp will search for all chips and shift them simultaneously.
Options¶
- -d <directory>
- Input directory to check for spectrum file, if a CPS id, instead
of a path, was provided. Defaults to
${SMEMP_WKDIR}/spectra/
. - -o <outdir>
- Specifies the directory to place the output files. If no directory is specified, output files are placed in the current directory.
- -f –flatten
- If the spectra from multiple chips are provided, flatten all into a single file.
- -nb –no_bootstrap
- Set this flag to perform the shift directly against the NSO spectrum, without bootstrapping. Useful for shifting non-HIRES spectra which have wavelength ranges not overlapping the library spectra.
- -p
- Set this flag to generate plots.
-p
generates a set of representative plots for the shifting process, using the results from order 2.-pp
generates the above plots, but for every order used. - -s <suffix>
- Suffix to append to output file names. Defaults to
_adj
Match¶
This command reads in a shifted and flattened spectrum, and performs a match with
the library spectra. It outputs a .hdf
file containing the specmatch-emp
results, as well as a .csv
file with the best chi-squared values when compared
against each library spectrum.
smemp match [-h] [-d DIRECTORY] [-o OUTDIR] [-p] [-i IN_LIBRARY] [-s SUFFIX] spectrum
- spectrum
- Either the full path to the target spectrum, or a CPS id (jXX.XXXX), where the
-d
option specifies the directory to look for the file.
Options¶
- -d <directory>
- Input directory to check for spectrum file, if a CPS id, instead
of a path, was provided. Defaults to
${SMEMP_WKDIR}/shifted_spectra/
. - -o <outdir>
- Specifies the directory to place the output files. If no directory is specified, output files are placed in the current directory.
- -p
- Set this flag to generate plots.
-p
generates a set of representative plots for the matching process, using the results from order 2.-pp
generates the above plots, but for every order used. - -i <lib_name>
- Excludes the spectrum with the given name in the library, from the specmatch algorithm. Meant for validation purposes.
- -s <suffix>
- Suffix to append to output file names.
Lincomb¶
This takes an intermediate .hdf
file generated by the match command, and runs the
linear combination step, generating the final stellar parameters.
smemp lincomb [-h] [-o OUTDIR] [-p] [-i IN_LIBRARY] [-n NUM_BEST] [-s SUFFIX] match_results
- match_results
- Path to
.hdf
file to be resumed.
Options¶
- -o <outdir>
- Specifies the directory to place the output files. If no directory is specified, output files are placed in the current directory.
- -p
- Set this flag to generate plots.
-p
generates a set of representative plots for the lincomb process, using the results from order 2.-pp
generates the above plots, but for every order used. - -i <lib_name>
- Excludes the spectrum with the given name in the library, from the specmatch algorithm. Meant for validation purposes.
- -n <num_best>
- Sets the number of best-matching spectra to use in the linear combination process. Defaults to 5.
- -s <suffix>
- Suffix to append to output file names.