User guide¶
Photometry Controller¶
This controller is the main point of access for any user, i.e. one does not need more to be able to extract Light Curves from the background stars in the CHEOPS mission;
-
class
Photo_controller
(job_number, config_path='configuration_files/config.yaml', no_optim=False)¶ Controller class that allows an easy interface with all the important functions in the module. If the no_optim parameter is set to False, then it automatically starts the optimization routine, at instantiation time of the class.
-
change_parameters
(params_dict)¶ Updates the kwargs with new values. A dictionary is passed in, with keys corresponding to parameters and each value it’s the new configuration for that specific parameter. At this stage no validation is made over the passed values. Such validation occurs before the routines, to make sure that the correct parameters were added.
Parameters: params_dict – Dictionary with the values that we wish to change
-
optimize
()¶ Run the optimization routine without instantiating a new object.
-
run
(DataFits=None, factor=None, **kwargs)¶ Calls the main method to run the star analysis pipeline
Parameters: - factor – Used for the optimization process. During normal functioning process then so value should be passed
- kwargs – Config values, retrieved from the file on the class initialization
Returns: data_fits
Return type: instance of
Data
, with the relevant information.
-
Data Object¶
-
class
Data
(filename)¶ Data structure to hold the information of all the stars in the field.
Parameters: - base_folder – location of the folder in which all the fits files are located.
- roll_ang – rotation angle for all the images.
- imgs – all the images in the fits file.
- stars – List in which all elements are a “Star” object that holds information of one star.
- mask_type – type of mask. either circle or shape
- detect_mode – detection mode used
- init_detection_mode – initial detection mode
- mjd_time – mjd time of the observations
-
abort_process
¶ If the error_flag is set then the process should be aborted
-
all_curves
¶ Light curve of all stars, in the star numbering order (from closest to center to farthest)
-
all_uncertainties
¶ Light curve of all stars, in the star numbering order (from closest to center to farthest)
-
calculate_uncertainties
(index)¶ Trigger the calculation of the uncertainties
Parameters: index (int) – Image number
-
disable_star
(star_number)¶ Disables a star to avoid computing redundant information i.e. after the best value has been found during the optimization process for one star, but others are still not yet optimized. :param star_number:
-
get_image
(number)¶ Ask for a given image. If the background grid is in use, returns the increased image
Parameters: number (int) – Image number Returns: image – Desired image Return type: numpy array
-
static
get_rot_mat
(angle, clockwise)¶ Returns a rotation matrix (around the origin) for a given angle :param angle: rotation angle, in degrees :param clockwise: True for a clockwise rotation and False for a counter clockwise rotation. :return: rotation matrix
-
is_empty
¶ See if the object has been used in a run, i.e. if it has data
Returns: True if it is empty or an error has been raised, False otherwise Return type: boolean
-
load_parameters
(factor=None, **kwargs)¶ Loads all the necessary information from the .fits files. Launches the routines to find the initial position of the stars and create the corresponding masks.
Before running the internal parameters, as well as the star’s ones are removed. This was made in order to minimize loading data from disk. However, keep in mind that the reset routine does not re-enable stars. So, if a star was disabled in this object, then it will stay that way unless a new object is instantiated. :param factor: :param kwargs:
Returns: - -1 – Errors were found during runtime
- 0 – Everything went without problems
-
reload_images
(**kwargs)¶ Reload images from disk, in the case that the desired image has been deleted :param kwargs:
Outputs¶
-
store_data
(data_fits, job_number, singular=None, **kwargs)¶ Stores the data extracted from the entire pipeline.
Like the controllers, it can work with a
Data
object that was used for both parts or only for one of them.If one wishes, it can also only create the folders and extract the data only for the chosen star.
Parameters: - data_fits –
Data
object. - job_number – Job number, from the supernova server. Will be used to save the parent folder inside the kwargs[“results_folder”] to create the entire directory structure.
- singular – If it’s not None, then only that star’s light curve is saved. Only works for the “show_results”.
- kwargs – Dictionary with the configuration values. Can be obtained with the
Photo_controller
parameters property
- data_fits –