shapepipe.modules.sextractor_package.sextractor_script

shapepipe.modules.sextractor_package.sextractor_script

SEXTRACTOR SCRIPT.

This module builds the SExtractor command line.

Author

Axel Guinot, Martin Kilbinger

get_header_value(image_path, key)[source]

Get Header Value.

This function reads a value from the header image.

Parameters
  • image_path (str) – Path to the input image

  • key (str) – Key from which the value is requested (has to be a float)

Returns

Value associated to the key provided

Return type

float

make_post_process(cat_path, f_wcs_path, pos_params, ccd_size)[source]

Make Post Processing.

This function will add one HDU for each epoch to the SExtractor catalogue. Note that this only works for tiles.

The columns will be:

  • NUMBER: same as SExtractor NUMBER

  • EXP_NAME: name of the single exposure for this epoch

  • CCD_N: extension where the object was detected

Parameters
  • cat_path (str) – Path to the outputed SExtractor catalog

  • f_wcs_path (str) – Path to the log file containing WCS for all single exp CCDs

  • pos_params (list) – World coordinates to use to match the objects.

  • ccd_size (list) – Size of a CCD [nx, ny]

Raises

IOError – If SQL file not found

class SExtractorCaller(path_input_files, path_output_dir, number_string, path_dot_sex, path_dot_param, path_dot_conv, use_weight, use_flag, use_psf, use_detection_image, use_detection_weight, use_zero_point, use_background, zero_point_key=None, background_key=None, check_image=None, output_prefix=None)[source]

Bases: object

The SExtractor Caller.

This class constructs the command line to call SExtractor based on the input files and parameters.

Parameters
  • path_input_files (list) – List with all the paths for the input files

  • path_output_dir (str) – Path for the output directory

  • number_string (str) – Pipeline internal file numbering

  • path_dot_sex (str) – Path to the .sex config file

  • path_dot_param (str) – Path to the .param config file

  • path_dot_conv (str) – Path to the .conv kernel file

  • use_weight (bool) – Specify if a weight is profided for the measurement

  • use_flag (bool) – Specify if a flag is provided for the measurement

  • use_psf (bool) – Specify if a psf is provided for the model

  • use_detection_image (bool) – Specify if a detection image is provided

  • use_detection_weight (bool) – Specify if a detection weight is provided

  • use_zero_point (bool) – Specify whether or not to use a zero point from the input image

  • use_backgroud (bool) – Specify whether or not to use a background value form the input image

  • zero_point_key (str, optional) – Header key corresponding to the zero point

  • background_key (str, optional) – Header key corresponding to the background value

  • check_image (str, optional) – If provided, add SExtractor check image to the output

  • output_prefix (str, optional) – If provided, add a prefix to the output file names

get_output_name(output_prefix=None)[source]

Get Output Names.

Construct the output file path.

Parameters

output_prefix (str, optional) – Prefix to add to the output name

Returns

Full path of the output file

Return type

str

set_input_files(use_weight, use_flag, use_psf, use_detect_img, use_detect_weight)[source]

Set Input Files.

Set up all of the input image files.

Parameters
  • use_weight (bool) – Specify if a weight is profided for the measurement

  • use_flag (bool) – Specify if a flag is provided for the measurement

  • use_psf (bool) – Specify if a psf is provided for the model

  • use_detect_img (bool) – Specify if a detection image is provided

  • use_detect_weight (bool) – Specify if a detection weight is provided

Raises

ValueError – For invalid detection weight

get_zero_point(use_zp, zp_key=None)[source]

Get Zero Point.

Use a zero point from an input image header.

Parameters
  • use_zp (bool) – If True, add the zero point to the command line

  • zp_key (str) – Header key corresponding to the zero point

get_background(use_bkg, bkg_key=None)[source]

Get Background.

Use a background value from an input image header.

Parameters
  • use_bkg (bool) – If True, add the background value to the command line

  • bkg_key (str) – Header key corresponding to the background value

get_check_image(check_image)[source]

Get Check Image.

Handle the check images if any are requested.

Parameters

check_image (list) – List of SExtractor keys corresponding to check images

make_command_line(exec_path)[source]

Make Command Line.

This method constructs the command line to run SExtractor.

Parameters

exec_path (str) – Path to SExtractor executable

Returns

Full command line to call SExtractor

Return type

str

static parse_errors(stderr, stdout)[source]

Parse Errors.

This methoid moves errors from the standard output of SExtractor to the standard error.

Parameters
  • stderr (str) – String containing the standard error contents

  • stdout (str) – String containing the standard output content

Returns

Updated standard output and error

Return type

tuple