Ejemplo n.º 1
0
from invisible_cities.icaro.hst_functions import shift_to_bin_centers
from invisible_cities.evm.ic_containers import Measurement

from .kr_types import KrEvent
from .kr_types import KrRanges
from .kr_types import ExyzNBins, KrNBins
from .kr_types import KrBins
from .kr_types import KrRanges
from .kr_types import XYRanges
from .kr_types import Ranges
from .kr_types import KrFit
from .kr_types import KrLTSlices

from typing import List, Tuple

labels = conditional_labels(True)


def energy_in_XYRange(kre: KrEvent, xr: Tuple[float], yr: Tuple[float],
                      ernb: ExyzNBins) -> KrFit:

    sel = in_range(kre.X, *xr) & in_range(kre.Y, *yr)
    e = kre.E[sel]
    bins = ernb.E
    frame_data = plt.gcf().add_axes((.1, .3, .8, .6))

    y, b, _ = plt.hist(e,
                       bins=bins,
                       histtype='step',
                       edgecolor='black',
                       linewidth=1.5)
Ejemplo n.º 2
0
from icaro.core.fit_functions import fit_profile_1d_expo

from typing import NamedTuple
from typing import Tuple
from typing import List

from .kr_types import KrEvent
from .kr_types import KrRanges
from .kr_types import KrNBins
from .kr_types import KrBins
from .kr_types import KrFit
from .kr_types import XYRanges
from .kr_types import Ranges

with_titles = True
labels = conditional_labels(with_titles)


def ns1(nsdf):
    hns1, bins = histo_ns1(nsdf.ns1)
    print(' 0S1/tot  = {} 1S1/tot = {} 2S1/tot = {}'.format(
        bin_ratio(hns1, bins, 0), bin_ratio(hns1, bins, 1),
        bin_ratio(hns1, bins, 2)))


def read_dsts(path_to_dsts):
    filenames = glob.glob(path_to_dsts + '/*')
    dstdf = load_dsts(filenames, group='DST', node='Events')
    nsdf = load_dsts(filenames, group='Extra', node='nS12')
    return nsdf, dstdf