Obs¶
The obs.py module is a collection of observables, which are suitable to detect anisotropies in the arrival directions of cosmic rays.
Cosmic ray observables
-
obs.
energy_energy_correlation
(vec, energy, vec_roi, alpha_max=0.25, nbins=10, **kwargs)[source]¶ Calculates the Energy-Energy-Correlation (EEC) of a given dataset for a given ROI.
- Parameters
vec – arrival directions of CR events shape=(3, n)
energy – energies of CR events in [EeV]
vec_roi – position of ROI center shape=(3,)
alpha_max – radial extend of ROI in radians
nbins – number of angular bins in ROI
kwargs –
additional named arguments
- bin_type: indicates if binning is linear in alpha (‘lin’)
or with equal area covered per bin (‘area’)
e_ref: indicates if the ‘mean’ or the ‘median’ is taken for the average energy
ref_mode: indicates if ‘e_ref’ is taken within ‘bin’ or the whole ‘roi’
verbose: if False, dont print warnings
- Returns
omega_mean: mean values of EEC (size: nbins)
- Returns
alpha_bins: angular binning (size: nbins)
- Returns
ncr_bin: average number of CR in each angular bin (size: nbins)
-
obs.
thrust
(p, weights=None, minimize_distances=None, ntry=1000)[source]¶ Thrust observable for an array (n x 3) of 3-momenta. Returns 3 values (thrust, thrust major, thrust minor) and the corresponding axes.
- Parameters
p – 3-momenta, (3 x n) matrix with the columns holding px, py, pz
weights – (optional) weights for each event, e.g. 1/exposure (1 x n)
minimize_distances – Instead of maximizing the distances to n3, this will miniminze the distances to n2 axis
ntry – number of samples for the brute force computation of thrust major
- Returns
tuple consisting of the following values
thrust, thrust major, thrust minor (shape: (3))
thrust axis, thrust major axis, thrust minor axis (shape: (3, 3))
-
obs.
two_pt_auto
(v, bins=180, **kwargs)[source]¶ Angular two-point auto correlation for a set of directions v. WARNING: Due to the vectorized calculation this function does not work for large numbers of events.
- Parameters
v – directions, (3 x n) matrix with the rows holding x,y,z
bins – number of angular bins or np.ndarray with bin in radians
kwargs –
additional named arguments
weights : weights for each event (optional)
cumulative : make cumulative (default=True)
normalized : normalize to 1 (default=False)
- Returns
bincount of size bins (or len(bins))
-
obs.
two_pt_cross
(v1, v2, bins=180, **kwargs)[source]¶ Angular two-point cross correlation for two sets of directions v1, v2. WARNING: Due to the vectorized calculation this function does not work for large numbers of events.
- Parameters
v1 – directions, (3 x n1) matrix with the rows holding x,y,z
v2 – directions, (3 x n2) matrix with the rows holding x,y,z
bins – number of angular bins or np.ndarray with bin in radians
kwargs –
additional named arguments
weights1, weights2: weights for each event (optional)
cumulative: make cumulative (default=True)
normalized: normalize to 1 (default=False)
- Returns
bincount of size bins (or len(bins))