shapepipe.modules.setools_package.setools
shapepipe.modules.setools_package.setools¶
SETOOLS.
This module contains a class to handle operations on SExtractor output catalogues.
- Authors
Axel Guinot
- class SETools(cat, output_dir, file_number_string, config_filepath, cat_file=True)[source]¶
Bases:
object
The SETools Class.
Tools to analyse SExtractor catalogues.
- Parameters
cat (str, numpy.ndarray) – Path to SExtractor catalogue (FITS_LDAC format) or numpy.ndarray (structured array)
output_dir (str) – Path to pipeline result directory
file_number_string (str) – input catalogue number/specifier
config_filepath (str) – Path to
config.setools
filecat_file (bool, optional) –
True
ifcat
is a path to a file,False
otherwise
- process(w_log)[source]¶
Process.
Main function called to process a SExtractor catalogue.
- Parameters
w_log (logging.Logger) – Logging instance
- read()[source]¶
Read the Configuration File.
This function read the config file and creates a dictionary for every task.
- Raises
RuntimeError – If not section found
ValueError – For invalid section
- _clean_line(line)[source]¶
Clean Lines.
This function is called during the reading process to clean lines from spaces, empty lines and ignore comments.
- save_mask(mask, output_path, ext_name='LDAC_OBJECTS')[source]¶
Save Mask.
This function will apply a mask to the data and save them into a new SExtractor-like FITS file.
- Parameters
mask (numpy.ndarray) – Numpy array of boolean containing
output_path (str) – Path to the general output directory
ext_name (str, optional) – Name of the HDU containing masked data; default is
LDAC_OBJECTS
SExtractor name
- Raises
ValueError – If mask not provided
ValueError – If output path not provided
- save_new_cat(new_cat, output_path, ext_name='LDAC_OBJECTS')[source]¶
Save New Catalogue.
This function creates a new catalogue with a specific format (FITS bin table, SExtractor-like FITS catalogue or ASCII).
- Parameters
- Raises
ValueError – If
OUTPUT_FORMAT
not providedValueError – For invalid output format
- save_rand_split(rand_split, output_path, file_number, ext_name='LDAC_OBJECTS')[source]¶
Save Random Split Catalogues.
Save two catalogues following the random split specified.
- Parameters
- Raises
ValueError – If
rand_split
not providedValueError – If
output_path
not providedValueError – If
file_number
not provided
- save_stat(stat, output_path)[source]¶
Save Statistics.
Save the statistics in ASCII format.
- Parameters
- Raises
ValueError – If
stat
not providedValueError – If
output
path not provided
- _make_mask()[source]¶
Make Mask.
This function transforms the constraints from the config file to conditions.
- Raises
RuntimeError – If value not found in mask
- _make_plot()[source]¶
Make Plot.
This function interpret the different parameters for the plot.
- Raises
ValueError – If plot option keyword or value is not in the correct format
ValueError – If plot keyword not in the correct format
- _make_new_cat()[source]¶
Make New Catalogue.
This function interprets the contents for each column of the new catalogue.
- Raises
ValueError – For invalid output format
- _make_rand_split()[source]¶
Make Random Split.
This function creates mask with random indices corresponding to the specfied ratio.
- Raises
ValueError – For invalid random split format
ValueError – If ratio is not a number
ValueError – If mask does not exist
- _make_stat()[source]¶
Make Statistics.
This function interprets the different statistics required.
- Raises
ValueError – For invalid statistics format
- class SEPlot(plot_dict, catalogue, output_path, mask_dict=None)[source]¶
Bases:
object
The SEPlot Class.
Tools to create plots.
- Parameters
plot_dict (dict) – Dictionary containing the parameters for the plot
catalogue (numpy.recarray or astropy.fits.fitsrec) – Array containing the full data
output_path (str) – Path for the output
mask_dict (dict, optional) – Dictionary containing masks to apply
- Raises
ValueError – If
plot_dict
not providedValueError – If
catalogue
not providedValueError – If
output_path
not providedValueError – If plot type not specified
ValueError – For invalid plot type
Notes
Types of plots available : plot, scatter, hist.
- _check_key_for_plot(key_list)[source]¶
Check Key for Plot.
Raise exception if keys not found in plot description.
- Parameters
key_list (list) – List of keys
- Raises
ValueError – If key not provided for plot type
- _make_plot()[source]¶
Make Plot.
This function calls
matplotlib.pyplot.plot
.- Raises
ValueError – If X not provided for each value of Y
ValueError – If plot keyword not in the correct format
See also
- _make_scatter()[source]¶
Make Scatter.
This function calls
matplotlib.pyplot.scatter
.- Raises
ValueError – If X not provided for every
SCATTER
ValueError – If Y not provided for every
SCATTER
See also