Stars

Star information

class Star(cdpp_type: str, pos=None, dist=None)
Star class that holds the star information. We have a class attribute, number, that will be used to name the star.
Each star increments this number by one.
Parameters:
  • cdpp_type
    CDPP algorithm; Can be a string or a function. If it is a string, it should be “K2”. Otherwise, the function should have the format
    def foo(flux, time):
    return metric
  • pos=None – Initial position
  • = None (dist) – Distance to center

Notes

name:
Designation of the star
masks:
Holds the mask used in each image.
GP_data:
Holds the GPs results
positions:
position, in pixels, of the centroid. Always on coordinates of the [200,200] grid
init_pos:
Initial position, in pixels, of the centroid. Always on coordinates of the [200,200] grid
out_bound:
An overlap between the mask and the empty region was found
_active:
Do we want to calculate the flux for this star
photom:
holds the light curve information
debug:
If 1 we compare the data obtained from our analysis with the one produced by the official pipeline
add_initial_mask(mask, factor, scaling_factor, low_memory=0)

Initializes the Masks class

Parameters:
  • mask – Initial mask for the star
  • factor – Increase factor for the mask
  • size_grid_change – Size of the background grid
  • low_memory – Mode in which only the necessary information is kept during the process
Returns:

  • 0 – If no error is found
  • -1 – If the factor is a negative number

add_mask(mask)

Adds a mask to the Masks object

Parameters:mask – mask to add
calculate_cdpp(time=None)

Calculates the CDPP of the light curve, in order to quantify the results

Returns:CDPP, CDPP_def
Return type:noise for my light curve and for the official one, respectively
change_init_pos(pos)

Change the star’s initial position. Used when more than one initial center determination method is active and some information needs to be overwritten :param pos: New position for the centroid of the star (for the 1st image)

disable()

Sets the flag to disable the calculation of the flux of this star.

enable_debug(**kwargs)

Extracts the default data from the FITS files :param base_folder: path to folder in which the FITS files are located

import_photom(photom)

Used when loading data from disk :param photom:

latest_mask

Returns the last mask added to the star.

out_bounds(index)

Take into account that star was out of bonds in a given frame

remove_data()

Empty all information stored on this star. Used during the optimization process

update_mask(scaling_factor, index)

Updates the mask with the information from the current image :param scaling_factor: Size of the background grid. :param index: Index of the current image

Initial Detection

centers_from_fits(primary: str, secondary: str, stars: List[T], initial_angle: float, initial_offset: List[T], **kwargs)

Using information stored on the fits files, we determine the centers positions. The centers are determined using relations between the differences in RA and DEC of all stars in relation to the known point : the central star.

After determining the center, we use the primary and secondary arguments to see if this function should change the initial position of the star.

Parameters:
  • primary (str) – Methodology to apply to the central star. If it’s fits then the initial position of that star is changed to be the one determined here.
  • secondary (str) –
    Methodology to apply to the outer stars. If it’s fits then the initial position of those stars are changed
    to be the ones determined here.
  • stars (list) – List with all the stars found with the dynam method
  • initial_angle (float) – Rotation angle of the satellite for the first image
  • initial_offset (list) – DRP’s estimation of the central star location
  • kwargs – kwargs
Returns:

Updated list of stars, with the positions determined by the fits method

Return type:

List

initial_dynam_centers(img, bg_grid, **kwargs)

Uses the same method as the one in dynamical_centers to detect the original position of each star. Afterwards, the positions are ordered by closeness to the center which allows us to keep the same order as in the “fits” initial position method. :param im: First image in the data set :param bg_grid: Size of the background grid

Star tracking

Handler

star_tracking_handler(Data_fits, index, **kwargs)

Handles the detection mode for the target star and the ones around it. Allows to have two different modes of detection active at the same time.

Parameters:
  • Data_fitspyarchi.main.initial_loads.Data object.
  • index – Image number
  • kwargs
Returns:

Error code of the different star tracking methods. 0 if everything as expected 1 otherwise

Return type:

int

Methods

static_method(Data_fits, img_number, primary, secondary)
Rotates the points in the last know position by the corresponding rotation angle (difference between current angle
and the one from the last image).
Parameters:
  • Data_fitspyarchi.main.initial_loads.Data object.
  • img_number – Number of the current image
  • primary – Methodology to apply to the central star. If it’s static then the central star is tracked using this method
  • secondary – Methodology to apply to the outer stars. If it’s static then they are tracked using this method
create_predictions(Data_fits, img_number)
Rotates the points in the last know position by the corresponding rotation angle (difference between current angle
and the one from the last image), predicting the next position of the star
Parameters:
  • Data_fitspyarchi.main.initial_loads.Data object.
  • img_number – Number of the current image
dynam_method(Data_fits, index, primary: str, secondary: str, repeat_removal: int)

This function is used to calculate the position of the center of each contour. In order to do that we calculate the moments of the image, which allows us to derive it’s “center of mass”. All contours with less than 7 points are discarded and, to associate center to star we use the rotate_points function to predict the center’s expected position. BY comparing the expected positions with the outputs of the algorithm we can associate a center to each star.

If the image processing routine is not able to detect any star, the it uses the predictions to shift the masks.

Parameters:
  • Data_fitspyarchi.main.initial_loads.Data object.
  • index – image’s number
  • primary – Methodology to apply to the central star. If it’s dynam then the central star is tracked using this method
  • secondary – Methodology to apply to the outer stars. If it’s dynam then they are tracked using this method
offsets_method(Data_fits, index, primary, secondary)

This function expands the functionality of rotate_points. After rotating the points we calculate the offset experienced by the central star, by calculating the deviation between the center location from the last two images. The offset center for the central star is simply obtained from the fits files, without rotating the previous point.

Parameters:
  • Data_fitspyarchi.main.initial_loads.Data object.
  • index – index of the image
  • primary – Methodology to apply to the central star. If it’s offsets then the central star is tracked using this method
  • secondary – Methodology to apply to the outer stars. If it’s offsets then they are tracked using this method