orcanet.lib.sample_modifiers

Some basic sample modifiers to use with orcanet. Use them by setting .cfg.sample_modifier of the orcanet.core.Organizer.

Module Contents

Classes

PerInputModifier

For modifiers that do the same operation on each input.

JoinedModifier

For applying multiple sample modifiers after each other.

Permute

Permute the axes of the samples to given order.

Reshape

Reshape samples to given shape.

GraphEdgeConv

Read out points and coordinates, intended for the MEdgeConv layers.

class orcanet.lib.sample_modifiers.PerInputModifier[source]

For modifiers that do the same operation on each input. Apply modify on x_value of each input, and output as dict.

abstract modify(x_value)[source]

x_value is a batch of input data as a numpy array.

class orcanet.lib.sample_modifiers.JoinedModifier(sample_modifiers)[source]

For applying multiple sample modifiers after each other.

modify(x_value)[source]

x_value is a batch of input data as a numpy array.

class orcanet.lib.sample_modifiers.Permute(axes)[source]

Permute the axes of the samples to given order. Batchsize axis is excluded, i.e. start indexing with 1!

modify(x_value)[source]

x_value is a batch of input data as a numpy array.

class orcanet.lib.sample_modifiers.Reshape(newshape)[source]

Reshape samples to given shape. Batchsize axis is excluded!

modify(x_value)[source]

x_value is a batch of input data as a numpy array.

class orcanet.lib.sample_modifiers.GraphEdgeConv(knn=16, node_features=('pos_x', 'pos_y', 'pos_z', 'time', 'dir_x', 'dir_y', 'dir_z'), coord_features=('pos_x', 'pos_y', 'pos_z', 'time'), ragged=True, with_lightspeed=True, column_names=None, is_valid_features='is_valid', n_hits_padded=None)[source]

Read out points and coordinates, intended for the MEdgeConv layers.

For DL files produced with OrcaSong in graph mode.

Parameters
knnint or None

Number of nearest neighbors used in the edge conv. Pad events with too few hits by duping first hit, and give a warning.

node_featurestuple

Defines the node features.

coord_featurestuple

Defines the coordinates.

raggedbool, optional

If True, return ragged tensors (nodes, coordinates). If False, return regular tensors, padded to fixed length. n_hits_padded and is_valid_features need to be given in this case.

with_lightspeedbool

Multiply time for coordinates input with lightspeed. Requires coord_features to have the entry ‘time’.

column_namestuple, optional

Name and order of the features in the last dimension of the array. If None is given, will attempt to auto-read the column names from the attributes of the dataset.

is_valid_featuresstr

Only for when ragged = False. Defines the is_valid.

n_hits_paddedint, optional

Only for when ragged = False. Pad or cut to exactly this many hits using 0s. Non-indexed datasets will automatically set this value.

reset_cache()[source]

Clear cached column names.