Fnotching


source

calc_indices_from_index


def calc_indices_from_index(
    n, # Length of condensed matrix
    c, # Index of the distance value of interest
): # Coordinate pair of the 2 indices that were used to calculate distance
at index c of the condensed distance matrix.

calculate source indices from condensed distance matrix.

The pdist function returns its measurements in a (01, 02, 03, 12, 13…) fashion and this function can be used to get out the original coordinates of the 2 inputs.


source

remove_opposing_fans


def remove_opposing_fans(
    fans, # Fan marking data
    eps:int=20
): # Data with opposing fans removed.

Find fans that have opposite orientation and remove lower voted one.

First check if any fans are close enough to be fnotched (same criteria as blotch-fan fnotching), then check if any of those have opposite orientation. Delete the one with lower votes. If number of votes is equal, take a random choice.


source

get_clusters_in_path


def get_clusters_in_path(
    path, # Path in where to search for L1A csv files.
): # List with 2 pd.DataFrames

Find csv files in path and combine into DataFrame.


source

get_id_from_path


def get_id_from_path(
    path
):

source

data_to_centers


def data_to_centers(
    df, # Dataframe with either fan or blotch marking data. It probes itself
which one it is by looking at if distances and radii are defined.
    kind, scope:str='hirise'
):

Convert a dataframe with marking data to an array of center coords.


source

fnotch_image_ids


def fnotch_image_ids(
    obsid, # Observation ID for which the clustering and fnotching is performed.
    eps:int=20, # The maximum distance in pixels to consider for fnotching, by default 20.
    savedir:NoneType=None, # Directory where the results will be saved, by default None.
    scope:str='hirise', # Coordinate scope of the calculation, by default "hirise".
):

Cluster each image_id for an obsid separately and perform fnotching.


source

write_l1c


def write_l1c(
    kind, # P4 marking kind
    slashed, # The remaining fnotch data after applying the cut
    pm, # The PathManager for the current image_id
):

Write the L1C for marking kind.


source

apply_cut_obsid


def apply_cut_obsid(
    obsid, cut:float=0.5, savedir:NoneType=None
):

source

apply_cut


def apply_cut(
    obsid, # HiRISE obsid, i.e. P4 `image_name`
    cut:float=0.5, # Value where to cut the vote_ratio of the fnotches.
    savedir:NoneType=None
):

Loop over all image_id paths for an obsid and apply cut to fnotches.