Skip to main content

Microservices for KM3NeT

Project description

https://git.km3net.de/km3py/km3services/badges/master/pipeline.svg https://git.km3net.de/km3py/km3services/badges/master/coverage.svg https://examples.pages.km3net.de/km3badges/docs-latest-brightgreen.svg

This Python package provides access to KM3NeT microservices. It’s in an early development stage and the API will likely change any until v1.0.0 is released.

Installation

As usual, install with pip:

pip install km3services

Available Microservices

OscProb

The km3services.oscprob module wraps the OscProb package to calculate neutrino oscillation probabilities. Here is an example how to calculate the transition probabilities from muon to electron neutrino (the API will be polished soon):

from km3services.oscprob import OscProb
import numpy as np

oscprob = OscProb()  # here you can pass a different server/port

n = 1000
energies = np.random.randint(1, 50, n)  # generate `n` energies between 1-50 GeV
cos_zeniths = -np.random.rand(n) / 2
# Use PDG particle encoding!
flav_in = 12   # electron neutrino
flav_out = 14  # muon neutrino

probabilities = oscprob.oscillationprobabilities(flav_in, flav_out, energies, cos_zeniths)
print(probabilities)

The returned probabilities is a numpy array:

[4.20254330e-03 7.46278836e-05 6.18139696e-04 4.03814960e-03
3.38002558e-03 3.33962606e-04 4.53159234e-02 5.03111960e-02
...
2.23391190e-03 2.07540790e-03 6.71385177e-03 3.03348121e-02
1.86633322e-02 4.81416626e-03 4.55362912e-05 3.59935810e-03]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

km3services-0.4.2.tar.gz (38.5 kB view hashes)

Uploaded Source

Built Distribution

km3services-0.4.2-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page