shapepipe.modules.vignetmaker_package.vignetmaker

shapepipe.modules.vignetmaker_package.vignetmaker

VIGNET MAKER.

This module contains a class to create postage stamps from images.

Author

Axel Guinot

class VignetMaker(galcat_path, pos_type, pos_params, output_dir, image_num)[source]

Bases: object

Vignet Maker.

This class handles the creation of vignets.

Parameters
  • galcat_path (str) – Path to catalogue containing the positions

  • pos_type (str) – Options are PIX or SPHE - PIX : position in pixel coordinates - SPHE : position in world coordinates

  • pos_params (list) – Parameters to use as positions, e.g. ['xpos', 'ypos']

  • output_dir (str) – Path to the output directory

  • image_num (str) – Image numbering

process(image_path_list, rad, prefix)[source]

Process.

Main function to create the stamps.

Parameters
  • image_path_list (list) – List of path for the input images

  • rad (int) – Radius to use for the stamps

  • prefix (str) – Prefix of the output file

get_pos(pos_params)[source]

Get Positions.

Get the positions of the given parameters from SExtractor catalogue.

Parameters

pos_params (list) – List of string containing the SExtractor’s parameters to use as positions

Returns

Array of the positions

Return type

numpy.ndarray

convert_pos(image_path)[source]

Convert Position.

Convert positions from world coordinates to pixel coordinates.

Parameters

image_path (str) – Path to the image from where the stamp are created

Returns

New positions in pixel coordinates

Return type

numpy.ndarray

_get_stamp(img_path, pos, rad)[source]

Get Stamp.

Extract stamps at given positions in the image.

Parameters
  • img_path (str) – Path to the image

  • pos (numpy.ndarray) – Array of positions for the vignet’s centres

  • rad (int) – Radius of the stamp, must be odd

Returns

Array containing the vignets

Return type

numpy.ndarray

_get_stamp_me(image_dir, image_pattern)[source]

Get Stamp Multi-Epoch.

Get stamps for multi-epoch data.

Parameters
  • image_dir (str) – Path to the directory where the images are

  • image_pattern (str) – Common part of the file names

Returns

Directory containing object id and vignets for each epoch

Return type

dict

process_me(image_dir, image_pattern, f_wcs_path, rad)[source]

Process Multi-Epoch.

Main function to create the stamps in the multi-epoch case.

Parameters
  • image_dir (list) – List of directories where the image are; ff len(image_dir) == 1 -> all images are in the same directory, else len(image_dir) must match len(image_pattern)

  • image_pattern (list) – Common part of each kind of file names

  • f_wcs_path (str) – Path to the log file containing the WCS for each CCDs

  • rad (int) – Radius of the stamp, must be odd

_save_vignet_me(output_dict, prefix)[source]

Save vignet Multi-Epoch.

Save vignets for the multi-epoch case.

Parameters
  • output_dict (dict) – Dictionary containing object id and vignets for each epoch.

  • prefix (str) – Prefix to use for the output file name

get_original_vignet(galcat_path)[source]

Get Original Vignet.

Get the vignets from the SExtractor catalogue.

Parameters

galcat_path (str) – Path to the SExtractor catalogue

Returns

Array containing the vignets

Return type

numpy.ndarray

make_mask(galcat_path, mask_value)[source]

Make Mask.

Change the value of the SExtractor mask in the vignet.

Parameters
  • galcat_path (str) – Path to the SExtractor catalogue

  • mask_value (float) – New value of the mask

Returns

Array of the vignets with the new mask value

Return type

numpy.ndarray

save_vignet(vignet, sexcat_path, output_dir, prefix, image_num)[source]

Save Vignet.

Save the vignet to a SExtractor format catalogue.

Parameters
  • vignet (numpy.ndarray) – Array containing the vignets to be saved

  • sexcat_path (str) – Path to the original SExtractor catalogue

  • output_dir (str) – Path to the output directory

  • prefix (str) – Prefix to use for the output file name

  • image_num (str) – Image numbering