mangadap.util.parser module
Provides a set of parsing utility functions.
Todo
Add function that will parse the default MaNGA fits file name (see
mangadap.config.defaults.manga_fits_root()
).
Copyright © 2019, SDSS-IV/MaNGA Pipeline Group
- class mangadap.util.parser.DefaultConfig(f=None, interpolate=False)[source]
Bases:
object
A wrapper for the ConfigParser class that handles None values and provides some convenience functions.
- mangadap.util.parser.arginp_to_list(inp, evaluate=False, quiet=True)[source]
Separate a list of comma-separated values in the input string to a
list
.- Parameters
inp (
str
,list
) – Input string with a list of comma-separated valuesevaluate (
bool
, optional) – Attempt to evaluate the elements in the list using eval.quiet (
bool
, optional) – Suppress terminal output.
- Returns
The list of the comma-separated values
- Return type
list
- mangadap.util.parser.list_to_csl_string(flist)[source]
Convert a list to a comma-separated string; i.e. perform the inverse of
arginp_to_list()
.- Parameters
flist (
list
) – List to convert to a comma-separated string- Returns
String with the values in the input list converted to strings separated by commas
- Return type
str
- mangadap.util.parser.parse_drp_file_name(name)[source]
Parse the name of a DRP file to provide the plate, ifudesign, and mode.
- Parameters
name (str) – Name of the DRP file.
- Returns
The plate, ifudesign, and mode (‘RSS’ or ‘CUBE’) of the DRP file pulled from the file name.
- Return type
int, int, str
- Raises
TypeError – Raised if name is not a string.
ValueError – Raised if if the file name does not look like a DRP file because it does not include ‘manga-’, ‘-LOG’, or ‘.fits.gz’.