ml_suite C++ API Reference

template<typename T>
class BaseFeature

Base class for all features.

All features have a feature_size which determines how many fields in the resulting feature array are writtien to by this feature.

Subclassed by IterativeFeature< T >, PostFeature< T >

Public Functions

inline size_t feature_size()
virtual ~BaseFeature() = default

Protected Attributes

size_t _feature_size
template<typename T>
class BasePulseModifier
#include <pulse_modifier.hpp>

Base class for all pulse modifiers.

All derived classes must implement the following methods: intialize(pulse_map, frame): Perform necessary calcuations to initialize the pulse modifier. operator()(times, charges, om_key): Modify pulse times and charges for a given DOM.

Subclassed by ChargeWeightedMeanTimePulseModifier< T >, ChargeWeightedMedianTimePulseModifier< T >

Public Functions

inline virtual void initialize(const I3RecoPulseSeriesMap &pulse_map, const I3Frame &frame)
inline virtual void operator()(std::vector<T> &charges, std::vector<T> &times, const OMKey &om_key)
virtual ~BasePulseModifier() = default
template<typename T>
class ChargePercentile : public PostFeature<T>

charge percentile

Public Functions

inline ChargePercentile(const std::vector<T> &percentiles)
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Private Members

std::vector<T> _percentiles
template<typename T>
class ChargeUntilT : public PostFeature<T>

Calculate the sum of all charges up to a time t.

The time t is relative to the time of the first pulse.

Public Functions

inline ChargeUntilT(const std::vector<T> &time_marks)
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Private Members

std::vector<T> _time_marks
template<typename T>
class ChargeWeightedMean : public PostFeature<T>

Public Functions

inline ChargeWeightedMean()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)
template<typename T>
class ChargeWeightedMeanAndStd : public PostFeature<T>

Public Functions

inline ChargeWeightedMeanAndStd()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)
template<typename T>
class ChargeWeightedMeanTimePulseModifier : public BasePulseModifier<T>
#include <pulse_modifier.hpp>

Calculate pulse times relative to charge weighted mean time of event

Public Functions

inline ChargeWeightedMeanTimePulseModifier()
inline virtual void initialize(const I3RecoPulseSeriesMap &pulse_map, const I3Frame &frame)
inline virtual void operator()(std::vector<T> &charges, std::vector<T> &times, const OMKey &om_key)

Private Members

T _time_offset = 0.
template<typename T>
class ChargeWeightedMedianTimePulseModifier : public BasePulseModifier<T>
#include <pulse_modifier.hpp>

Calculate pulse times relative to charge weighted median time of event. Set interpolate to true if the median should be interpolated if between two times.

Public Functions

inline ChargeWeightedMedianTimePulseModifier(bool interpolate = false)
inline virtual void initialize(const I3RecoPulseSeriesMap &pulse_map, const I3Frame &frame)
inline virtual void operator()(std::vector<T> &charges, std::vector<T> &times, const OMKey &om_key)

Private Members

T _time_offset = 0.
bool _interpolate = false
template<typename T>
class ChargeWeightedStd : public PostFeature<T>

Public Functions

inline ChargeWeightedStd()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)
template<typename T>
class EventFeatureExtractor

Event Feature Extractor class.

The event feature extractor class applies exclusions, modifies pulses (e.g. relative time offset or cleaning), and extracts features for a given event.

Public Functions

inline EventFeatureExtractor(const std::string &pulse_key, std::shared_ptr<FeatureExtractor<T>> feature_extractor, std::shared_ptr<BasePulseModifier<T>> pulse_modifier, size_t n_strings = 86, size_t n_doms = 60)
inline EventFeatureExtractor(const std::string &pulse_key, std::shared_ptr<FeatureExtractor<T>> feature_extractor)
inline size_t size()

Return number of features.

inline size_t n_doms()

Return number of doms.

inline size_t n_strings()

Return number of strings.

inline void setExclusions(const std::vector<std::string> &exclusions, bool partial_exclusion)

Set DOM and TimeWindow exclusions

inline void fill_feature_matrix(T *matrix, const boost::python::object &frame_obj)

Helper function to fill the feature array from the frame

inline I3MapKeyVectorDoublePtr get_feature_map(boost::python::object &frame_obj)

Extract features from frame and return a map omkey -> feature vec for all DOMs that have at least one non-zero feature

inline std::shared_ptr<FeatureExtractorFrameObject> get_frame_object(boost::python::object &frame_obj)

Extract features from frame and return a FeatureExtratorFrame object DO WE STILL NEED THIS?

inline bn::ndarray operator()(boost::python::object &frame_obj)

Extract features from event and return ndarray[n_strings][n_doms][n_features]

virtual ~EventFeatureExtractor() = default

Private Members

std::shared_ptr<FeatureExtractor<T>> _feature_extractor
std::shared_ptr<BasePulseModifier<T>> _pulse_modifier
std::string _pulse_key
std::vector<std::string> _exclusions
bool _partial_exclusion
bool _apply_exclusions
size_t _n_features
size_t _n_strings
size_t _n_doms
template<typename T>
class FeatureExtractor

Class for dispatching the feature calculation to the individual Feature objects.

Public Functions

inline FeatureExtractor()
inline size_t n_features()
inline size_t size()
inline void addFeature(std::shared_ptr<BaseFeature<T>> feature)
inline void operator()(std::vector<T> &charge, std::vector<T> &time, T *result_ptr)

Private Members

std::vector<std::pair<std::shared_ptr<IterativeFeature<T>>, size_t>> _f_it_reg
std::vector<std::pair<std::shared_ptr<PostFeature<T>>, size_t>> _f_post_reg
size_t _tot_feat_size = 0
class FeatureExtractorFrameObject : public I3FrameObject

Public Functions

inline FeatureExtractorFrameObject()
inline FeatureExtractorFrameObject(const std::vector<double> &nonzero_data, const std::vector<int> &nonzero_indices, int n_strings, int n_doms, int n_features)
std::ostream &Print(std::ostream &oss) const override
inline std::vector<double> GetData()
inline std::vector<int> GetIndices()
inline int GetNStrings()
inline int GetNDOMs()
inline int GetNFeatures()
inline size_t size()
inline bn::ndarray GetFeatureArray()

Protected Attributes

std::vector<double> _nonzero_data
std::vector<int> _nonzero_indices
int _n_strings
int _n_doms
int _n_features

Private Functions

template<class Archive>
void serialize(Archive &ar, unsigned version)

Friends

friend class icecube::serialization::access
template<typename T>
class IterativeFeature : public BaseFeature<T>

Base class for iterative features.

Iterative features operate on one pulse at a time.

Subclassed by TotalCharge< T >

Public Functions

virtual void operator()(const T charge, const T time, T *result_ptr) = 0
template<typename T>
class MeanVarianceAccumulator
#include <utils.hpp>

Public Functions

inline MeanVarianceAccumulator(int dof = 1)
inline void add_element(const T &value, const T &weight)
inline T count()
inline T mean()
inline T var()
inline T std()

Public Members

T sumw = 0.0
T wmean = 0.0
T t = 0.0
int n = 0

Private Members

int _dof
template<typename T>
class PostFeature : public BaseFeature<T>

Base class for post features.

Post features operate on vectors of charges and times

Subclassed by ChargePercentile< T >, ChargeUntilT< T >, ChargeWeightedMean< T >, ChargeWeightedMeanAndStd< T >, ChargeWeightedStd< T >, TFirstPulse< T >, TimeAtChargePercentile< T >, TLastPulse< T >, TSpread< T >, TStd< T >

Public Functions

virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr) = 0

Public Members

bool req_chg_sorted = false
template<typename T>
class TFirstPulse : public PostFeature<T>

Public Functions

inline TFirstPulse()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Public Members

bool req_chg_sorted = false
template<typename T>
class TimeAtChargePercentile : public PostFeature<T>

Return time after which given percentile of the charge has been collected.

Public Functions

inline TimeAtChargePercentile(const std::vector<T> &percentiles)
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Private Members

std::vector<T> _percentiles
template<typename T>
class TLastPulse : public PostFeature<T>

Public Functions

inline TLastPulse()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Public Members

bool req_chg_sorted = false
template<typename T>
class TotalCharge : public IterativeFeature<T>

Calculate the sum of all charges

Public Functions

inline TotalCharge()
inline virtual void operator()(const T charge, const T time, T *result_ptr)
template<typename T>
class TSpread : public PostFeature<T>

Public Functions

inline TSpread()
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Public Members

bool req_chg_sorted = false
template<typename T>
class TStd : public PostFeature<T>

Public Functions

inline TStd(int dof = 1)
inline virtual void operator()(const std::vector<T> &charge, const std::vector<T> &time, T *result_ptr)

Public Members

bool req_chg_sorted = false

Private Members

int _dof
namespace std

STL namespace.

file event_feature_extractor.hpp
#include <string>
#include <vector>
#include <memory>
#include “icetray/I3Frame.h”
#include “icetray/OMKey.h”
#include “dataclasses/physics/I3RecoPulse.h”
#include “dataclasses/I3Map.h”
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
#include <boost/make_shared.hpp>
#include “exclusions.hpp
#include “pulse_modifier.hpp
#include “feature_extractor.hpp
file exclusions.hpp
#include <vector>
#include <memory>
#include “icetray/I3Frame.h”
#include “dataclasses/physics/I3RecoPulse.h”
#include “dataclasses/I3Map.h”
#include “dataclasses/I3TimeWindow.h”

Functions

I3RecoPulseSeriesMapPtr get_valid_pulse_map(const I3Frame &frame, const std::string pulse_key, std::vector<std::string> dom_exclusions, const bool partial_exclusion, const bool verbose)

Apply DOM and TimeWindow Exclusions

This method creates a new pulse series based on the given pulse series name, but excludes pulses and DOMs as specified with the dom_exclusions and partial_exclusion.

file feature_extractor.hpp
#include <vector>
#include <memory>
#include <set>
#include <functional>
#include <numeric>
#include <iostream>
#include <utility>
#include <stdexcept>
file feature_extractor_frameobj.cxx
#include <icetray/I3Logging.h>

Functions

I3_SERIALIZABLE(FeatureExtractorFrameObject)
std::ostream &operator<<(std::ostream &oss, const FeatureExtractorFrameObject &d)
file feature_extractor_frameobj.h
#include <icetray/serialization.h>
#include <icetray/I3Logging.h>
#include <icetray/I3FrameObject.h>
#include <vector>
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>

Functions

std::ostream &operator<<(std::ostream &oss, const FeatureExtractorFrameObject &d)
I3_POINTER_TYPEDEFS(FeatureExtractorFrameObject)
I3_CLASS_VERSION(FeatureExtractorFrameObject, feature_extractor_frame_object_version_)

Variables

static const unsigned feature_extractor_frame_object_version_ = 0
file pulse_modifier.hpp
#include <vector>
#include “icetray/I3Frame.h”
#include “icetray/OMKey.h”
#include “dataclasses/physics/I3RecoPulse.h”
#include “dataclasses/I3Map.h”
#include “utils.hpp
file utils.hpp
#include <map>
#include “icetray/OMKey.h”
#include <numeric>
#include <algorithm>
#include <vector>
#include <memory>

Functions

template<typename T, typename Compare>
std::vector<std::size_t> sort_permutation(const std::vector<T> &vec, Compare &compare)
template<typename T>
std::vector<std::size_t> sort_permutation(const std::vector<T> &vec)
template<typename T>
void apply_permutation_in_place(std::vector<T> &vec, const std::vector<std::size_t> &p)
template<typename T>
std::vector<T> apply_permutation(const std::vector<T> &vec, const std::vector<std::size_t> &p)
dir icetray
dir ml_suite
dir ml_suite
dir ml_suite
dir private
dir public