classify_photons.py

Yet Another Photon Classifier for ATL03 Global Geolocated Photon Data

Calling Sequence

from yapc.classify_photons import classify_photons

# calculate photon event weights
pe_weights = classify_photons(x_atc[i1], h_ph[i1],
    h_win_width, i2, K=0, min_ph=3, min_xspread=1.0,
    min_hspread=0.01, win_x=15, win_h=3, method='linear')

Source code

General Methods

yapc.classify_photons.classify_photons(x, h, h_win_width, indices, **kwargs)[source]

Use the NASA GSFC YAPC k-nearest neighbors algorithm to determine weights for each photon event

Parameters
x: float

along-track x coordinates for photon events

h: float

photon event heights

h_win_width: float

height of (possibly 2) telemetry bands

indices: int

indices of photon events to classify

K: int, default 0

number of values for KNN algorithm

  • Set to 0 for dynamic selection of neighbors

min_knn: int, default 5

minimum number of values for KNN algorithm

min_ph: int, default 3

minimum number of photons to be valid

min_xspread: float, default 1.0

minimum along-track spread of photon events

min_hspread: float, default 0.01

minimum window of heights for photon events

win_x: float, default 15.0

along-track length of window

win_h: float, default 6.0

height of window

  • Set to 0 for dynamic window height

aspect: float, default 0.0

aspect ratio of x and h window

  • Set to 0 for pre-defined window dimensions

method: str, default ‘linear’

algorithm for computing photon event weights

  • 'ball_tree': use scikit.learn.BallTree with custom distance metric

  • 'linear': use a brute-force approach with linear algebra

  • 'brute': use a brute-force approach

metric: str, default ‘height’

metric for computing distances

  • 'height': height differences

  • 'manhattan': manhattan distances

return_window: bool, default False

return the width and height of the selection window

return_K: bool, default False

return the dynamically selected number of values

yapc.classify_photons.windowed_manhattan(u, v, window=[], w=[])[source]

Create a windowed Manhattan distance metric

Parameters
u: float

Input array

v: float

Input array for distance

window: float or list, default []

distance window for reducing neighbors

w: float or list, default []

weights for each value

yapc.classify_photons.distance_matrix(u, v, p=1, window=[], w=[])[source]

Calculate distances between two collections of points

Parameters
u: float

First collection of coordinates

v: float

Second collection of coordinates

p: int, default 1

Power for calculating distance

  • 1: Manhattan distances

  • 2: Euclidean distances

window: float or list, default []

Distance window for reducing neighbors

w: float or list, default []

weights for each value