icecube.steamshovel.artists.util module

icecube.steamshovel.artists.util.TankPositionGenerator(geometry)

Returns the OMKeys and positions of IceTop tanks.

icecube.steamshovel.artists.util.cornertext(text, loc=2, color=None, frameon=False, axes=None, borderpad=None, borderaxespad=None, handletextpad=None, **kwargs)

Conveniently places text in a corner of an MPL plot. Mimics pyplot.legend(…). Requires matplotlib.

Parameters:
  • text – string or tuple of strings Text to be placed in the plot. May be a tuple of strings to get several lines of text.

  • loc – integer or string Location of text, same as in legend(…).

  • frameon – boolean (optional) Whether to draw a border around the text. Default is False.

  • axes – Axes (optional, default: None) Axes object which houses the text (defaults to the current axes).

Other keyword arguments are forwarded to the text instance.

Authors: Hans Dembinski <hans.dembinski@icecube.wisc.edu>

icecube.steamshovel.artists.util.detector_outline(bottom_vec3d_list, top_vec3d_list)

Returns detector outline by detecting points at the border.

Only works for standard hexagon grid.

icecube.steamshovel.artists.util.format_engineering(number, unit='')

Writes a string in engineering notation (k,M,m,…).

Parameters:
  • number – number to format

  • unit – optional unit string to append

Returns:

formatted string

Should be the inverse of parse_engineering(…).

icecube.steamshovel.artists.util.jacobian(f, x, dx)

Numerically calculate matrix of first derivatives. Needed for error propagation.

Requires numpy.

Parameters:
  • f – function-like, has to be callable as f(x)

  • x – array-like, vector of parameters

  • steps – array-like (optional), vector of deltas to use in numerical approximation

Returns:

Jacobi matrix of first derivatives

Examples:

>>> def f(v): return 0.5*np.dot(v,v)
>>> jacobian(f,np.ones(2))
array([[ 1.,  1.]])
>>> def f(v): return np.dot(v,v)*v
>>> jacobian(f,np.ones(2))
array([[ 4.,  2.],
       [ 2.,  4.]])

Authors: Hans Dembinski <hans.dembinski@kit.edu>

icecube.steamshovel.artists.util.mpl_hist(x, y, **kwargs)
icecube.steamshovel.artists.util.parse_engineering(string, unit='')

Parses a string in engineering notation (k,M,m,…).

Parameters:
  • string – string to parse

  • unit – unit to expect, if it is not there, raise ValueError

Returns:

parsed float

Use u for micro. We cannot parse the mu sign since we are limited to ASCII.

icecube.steamshovel.artists.util.particle_pos(particle, time)

Returns the position of a particle at the given time.

icecube.steamshovel.artists.util.propagate_covariance(f, x, cov)

Computes the covariance matrix of y for the transformation y = f(x), given x with covariance matrix cov.

Requires numpy.

Parameters:
  • f – function-like, has to be callable as f(x)

  • x – array-like, vector of parameters

  • cov – 2-d array of floats, covariance matrix of x

Returns:

fcov: matrix of floats, covariance matrix of the output of f

Examples:

>>> import numpy as np
>>> v = np.ones(2)
>>> cov = np.ones((2,2))
>>> def f(r):return np.dot(r,r)
>>> "%.3g" % propagate_covariance(f,v,cov)
'16'
>>> def f(r):return 2*r
>>> propagate_covariance(f,v,cov)
array([[ 4.,  4.],
       [ 4.,  4.]])

Authors: Hans Dembinski <hans.dembinski@kit.edu>

icecube.steamshovel.artists.util.signed_r_z(rotation_matrix, positions, core)

Returns signed lateral distance with r > 0 as early and r < 0 as late hits. For the rotation matrix, use to_shower_cs(…).

Requires numpy.

icecube.steamshovel.artists.util.to_shower_cs(i3direction: I3Direction)

Returns rotation matrix to shower CS for given i3direction.

Requires numpy.