llama.safeimports.realtime_tools_stubs module

Provide realtime_tools functionality from IceCube so that the pipeline can run without installing a full-fledged IceCube environment. In particular, implement live.get_events and neutrino_singlet_pulls.calc_cr_pull.

User must provide a valid IceCube username and password as environmental variables ICECUBE_USERNAME and ICECUBE_PASSWORD, respectively.

llama.safeimports.realtime_tools_stubs.calc_cr_pull(cr_zen, cr_azi, zenith, muex)

Calculate CR pull corrected value, based on cr_zen,cr_azi, zenith and muex values based on Thomas’s polynomial fit for neutrino16 sample

NOTE: This is modified from the IceCube code to run stand-alone.


Datatypes for events.

llama.safeimports.realtime_tools_stubs.get_events(topic, starttime, stoptime, timekey=None, retries=10, delay=30)

Query events from the I3Live database.

  • topic (str) – Name of the stream (e.g. ‘neutrino16’).
  • starttime (int or float) – start of timewindow
  • stoptime (int or float) – stop of timewindow
  • timekey (str) – which date/time to compare to, such as insert_time or value.data.eventtime (default: auto-detect)
  • retries (int) – Number of retries in case of HTTP errors
  • delay (int or float) – time delay between retries (default: 10 seconds)

  • events (list or None) – Events matching the given criteria or None in case of (repeated) HTTP error.
  • NOTE (This is modified from the IceCube code to run stand-alone.)


Taken from:

llama.safeimports.realtime_tools_stubs.parse_neutrino_event_stream(messages, dtype=None)

Stub version of the icecube.realtime_gfu.eventcache.NeutrinoEventStream().parse method, published at:


Parses and formats a bunch of neutrinos in the format returned by icecube.realtime_tools.get_live, picking the correct fields from those neutrinos such that the result is suitable for analyses. Based on discussions with Thomas Kintscher and Josh Wood.

llama.safeimports.realtime_tools_stubs.pull_correct_online_2017(cramerrao, paraboloid, bootstrap, logE, mode='MuEX')

Taken from:

llama.safeimports.realtime_tools_stubs.pull_correction(values, logE, splines, fixed_fallback=None)

Apply pull-correction to angular error estimators. Taken from:

  • values (list) – List of NumPy arrays with the sigma estimates.
  • logE (array) – The logE of the events.
  • splines (list) – Splines to be used for the corrections.
  • fixed_fallback (float) – Should all estimators fail, use this fixed value

Convert a given timestamp into a string of ‘YYYY-MM-DD hh:mm:ss.ffffff’.

The input must be either an MJD (float) or a datetime object.

NOTE: This is modified from the IceCube code to run stand-alone. It DOES NOT ACCEPT I3Time instances.