ananke.models package

Submodules

ananke.models.detector module

Contains all the classes for representing a detector.

class ananke.models.detector.PMTs(*, df: DataFrame[PMTSchema])[source]

Bases: DataFrameFacade

Python class representing individual PMT.

df: DataFrame[PMTSchema]
property pmt_locations: Vectors3D

Gets DataFrame with (x,y,z)-locations of PMTs.

property pmt_orientations: Vectors3D

Gets DataFrame with (x,y,z)-orientations of PMTs.

property pmt_areas: Series

Gets Dataframe with PMT area.

property pmt_efficiencies: Series

Gets Dataframe with PMT efficiencies.

property pmt_noise_rates: Series

Gets Dataframe with PMT noise rates.

class ananke.models.detector.Modules(*, df: DataFrame[ModuleSchema])[source]

Bases: PMTs

Python class representing individual module.

df: DataFrame[ModuleSchema]
property module_locations: Vectors3D

Gets DataFrame with (x,y,z)-location of modules.

property module_radius: Series

Gets Dataframe with Module radius.

class ananke.models.detector.Strings(*, df: DataFrame[DetectorSchema])[source]

Bases: Modules

Python class representing individual string.

df: DataFrame[DetectorSchema]
property string_locations: Vectors3D

Gets DataFrame with (x,y,z)-location of modules.

class ananke.models.detector.Detector(*, df: DataFrame[DetectorSchema], configuration: Optional[DetectorConfiguration] = None, id_columns: List[str] = ['string_id', 'module_id', 'pmt_id'])[source]

Bases: Strings

Python class representing detector.

configuration: Optional[DetectorConfiguration]
id_columns: List[str]
property indices: DataFrame

Returns all indices of the PMTs.

property outer_radius: float

Returns the distance of the farthest out module.

property outer_cylinder: Tuple[float, float]

Returns a tuple of the height and radius of the outer cylinder.

property number_of_pmts: int

Gets total number of pmts.

property number_of_modules: int

Gets total number of modules.

property number_of_strings: int

Gets total number of strings.

ananke.models.event module

This module contains all event and photon source related structures.

class ananke.models.event.RecordIds(*, df: DataFrame[RecordIdSchema])[source]

Bases: DataFrameFacade

General description of a record ids.

df: DataFrame[RecordIdSchema]
get_by_record_ids(record_ids: Optional[Union[int, List[int], Series]], invert: bool = False) Optional[RecordIds][source]

Gets all sources by a record id.

Parameters:
  • record_ids – ID(s) of the record to get

  • invert – Get except passed record ids

Returns:

Records with given ids

property record_ids: Series

Gets all the record ids of the current df.

class ananke.models.event.TimeStatistics(*, count: NonNegativeInt, min: float, max: float)[source]

Bases: BaseModel

Model for staticstical information of record.

count: NonNegativeInt
min: float
max: float
class ananke.models.event.RecordTimes(*, df: DataFrame[TimedSchema])[source]

Bases: DataFrameFacade

General description of intervals.

df: DataFrame[TimedSchema]
property times: Series

Gets DataFrame with all times.

add_time(time_difference: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) None[source]

Adds time to the data frame.

Parameters:

time_difference – time to add

get_statistics(percentile: Optional[float] = None) TimeStatistics[source]

Returns the Statistics of the current hits.

Parameters:

percentile – Float between 0 and one to give percentile of included rows.

Returns:

TimeStatistics Object containing min, max, and count

class ananke.models.event.Records(*, df: DataFrame[RecordSchema])[source]

Bases: RecordIds, RecordTimes

General description of a record for events or sources.

df: DataFrame[RecordSchema]
class ananke.models.event.RecordStatistics(*, df: DataFrame[RecordStatisticsSchema])[source]

Bases: Records

General description of a record for events or sources.

df: DataFrame[RecordStatisticsSchema]
class ananke.models.event.OrientedRecords(*, df: DataFrame[OrientedRecordSchema])[source]

Bases: OrientedLocatedObjects, Records

General description of a record for events or sources.

df: DataFrame[OrientedRecordSchema]
class ananke.models.event.Sources(*, df: DataFrame[SourceSchema])[source]

Bases: OrientedRecords

Record for a photon source.

df: DataFrame[SourceSchema]
property number_of_photons: Series

Gets DataFrame with all numbers of photons.

class ananke.models.event.EventRecords(*, df: DataFrame[EventRecordSchema])[source]

Bases: OrientedRecords

Record of an event that happened.

df: DataFrame[EventRecordSchema]
class ananke.models.event.NoiseRecords(*, df: DataFrame[NoiseRecordSchema])[source]

Bases: Records

Record of an event that happened.

df: DataFrame[NoiseRecordSchema]
class ananke.models.event.FullRecords(*, df: DataFrame[FullRecordSchema])[source]

Bases: Records

General description of a record for events or sources.

df: DataFrame[FullRecordSchema]
class ananke.models.event.Hits(*, df: DataFrame[HitSchema])[source]

Bases: Records

Record of an event that happened.

df: DataFrame[HitSchema]

ananke.models.geometry module

This module contains all geometric dataclasses.

class ananke.models.geometry.Vectors2D(*, df: DataFrame[Vector2DSchema])[source]

Bases: DataFrameFacade

A 2D vector with interface to radial and cartesian coordinates.

df: DataFrame[Vector2DSchema]
property phi: Series

Phi coordinate in radial units.

property norm: Series

Returns L2-norm of 2D vector.

scale_to_length(length: float) None[source]

Scaling the vector to a given length.

Parameters:

length – length to scale the vector to.

classmethod from_polar(polar: DataFrame[PolarSchema])[source]

Creates a 2D vector from polar coordinates.

Parameters:

polar – DataFrame with columns (norm, phi)

Returns:

2D Vector with the given properties.

classmethod from_numpy(numpy_array: ndarray[Any, dtype[Any]])[source]

Creates 2d vector out of numpy array.

Parameters:

numpy_array – numpy array of length two [x, y]

Returns:

2d vector by given numpy array

class ananke.models.geometry.Vectors3D(*, df: DataFrame[Vector3DSchema])[source]

Bases: Vectors2D

A 3D vector with interface to radial and spherical coordinates.

df: DataFrame[Vector3DSchema]
property theta: Series

Phi coordinate in radial units.

property phi: Series

Phi coordinate in radial units.

classmethod from_polar(polar: DataFrame[PolarSchema])[source]

3D vector cannot be created from polar.

Raises:

AttributeError – A creation from polar coordinates is not possible

classmethod from_spherical(spherical: DataFrame[SphericalSchema])[source]

Create 3D vector based on spherical coordinates.

Parameters:

spherical – Dataframe with columns (norm, phi, theta)

Raises:

AttributeError – A creation from polar coordinates is not possible

classmethod from_numpy(numpy_array: ndarray[Any, dtype[Any]])[source]

Creates 3d vector out of numpy array.

Parameters:

numpy_array – numpy array of length three [x, y, z]

Returns:

3d vector by given numpy array

classmethod from_df(df: DataFrame, prefix: str = '')[source]

Returns a DataFrame of 3d vectors.

As many of the classes have a prefix in front of the coordinates, this method strips the prefix and returns a valid 3dVectors object

Parameters:
  • df – DataFrame with columns

  • prefix – prefix to be stripped

Returns:

Valid Vectors3D Object

get_df_with_prefix(prefix: str = '') DataFrame[source]

Gets DataFrame from Vectors with prefixed columns for later use.

Parameters:

prefix – prefix to prepend (x,y,z)-columns

Returns:

DataFrame with prefixed columns.

class ananke.models.geometry.LocatedObjects(*, df: DataFrame[LocatedObjectSchema])[source]

Bases: DataFrameFacade

Object that has a location.

df: DataFrame[LocatedObjectSchema]
property locations: Vectors3D

Gets the 3D vectors data frame of the locations.

class ananke.models.geometry.OrientedLocatedObjects(*, df: DataFrame[OrientedLocatedObjectSchema])[source]

Bases: LocatedObjects

Object that has a location and orientation.

df: DataFrame[OrientedLocatedObjectSchema]
property orientations: Vectors3D

Gets the 3D vectors data frame of the orientations.

ananke.models.interfaces module

Place for all interfaces used in the package.

class ananke.models.interfaces.DataFrameFacadeIterator(facade: DataFrameFacade_, batch_size: int = 1)[source]

Bases: Iterator[DataFrameFacade_]

Class serving as iterator for the DataFrameFacade’s.

class ananke.models.interfaces.DataFrameFacade(*, df: DataFrame[T_])[source]

Bases: BaseModel

Interface for making a class numpy representable.

df: DataFrame[T_]
to_numpy(dtype: Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]] = None) ndarray[Any, dtype[Any]][source]

Converts data frame to numpy array.

Parameters:

dtype – Type of the final dataframe.

Returns:

Numpy array based on data frame.

classmethod concat(facades_to_concat: Sequence[Optional[DataFrameFacade]]) Optional[DataFrameFacade][source]

Concats multiple facades to one.

Parameters:

facades_to_concat – List of facades to concat

Returns:

Concatenated Facade

sample(n: int = 1, random_state: Optional[Generator] = None) DataFrameFacade[source]

Returns class with a random sample of its dataframe rows.

Parameters:
  • n – number of samples to draw.

  • random_state – random state to choose

Raises:

ValueError – When fewer samples than required are available.

Returns:

Class with the given number of random samples.

iterbatches(batch_size: int = 1) DataFrameFacadeIterator[DataFrameFacade_][source]

Get iterator of current facade.

Parameters:

batch_size – How many rows in each iteration

Returns:

Iterator for batched dataframe iteration

itertuples(index: bool = True) Iterable[tuple[Any, ...]][source]

Pass through itertuples from dataframe with name.

Parameters:

index – Whether index should be part of the Tuple

Returns:

Itertuples iterator of dataframe.

Module contents

Package containing all data models with business logic for cross package use.

Examples

  • Detector class and all its subclasses