Skip to content

Commit

Permalink
add logging around I3PhotoSplineService startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Oct 2, 2023
1 parent 6b25f1d commit 5238055
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion skymap_scanner/client/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main() -> None:
# go!
RecoAlgo = recos.get_reco_interface_object(args.reco_algo)
reco = RecoAlgo()
reco.setup_reco()
reco.setup_reco(LOGGER)

LOGGER.critical(f'/dev/shm: {os.listdir("/dev/shm")}')

Expand Down
2 changes: 1 addition & 1 deletion skymap_scanner/client/reco_icetray.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def notifyStart(frame):
# create instance of reco_algo object
RecoAlgo = recos.get_reco_interface_object(reco_algo)
reco = RecoAlgo()
reco.setup_reco()
reco.setup_reco(LOGGER)

# perform fit
tray.AddSegment(
Expand Down
9 changes: 6 additions & 3 deletions skymap_scanner/recos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ def prepare_frames(self, tray, name, **kwargs) -> None:
pass

@abstractmethod
def setup_reco(self):
"""Performs the necessary operations to prepare the execution of the reconstruction traysegment.
def setup_reco(self, logger):
"""Performs the necessary operations to prepare the execution of the
reconstruction traysegment.
This method is expected to perform "expensive" operations such as fetching spline data and initializing IceTray spline services.
This method is expected to perform "expensive" operations such
as fetching spline data and initializing IceTray spline
services.
"""
pass

Expand Down
4 changes: 2 additions & 2 deletions skymap_scanner/recos/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self):
self.refine_time = True
self.add_fallback_position = False

def setup_reco(self):
pass
def setup_reco(self, logger):
logger.info("Dummy reco has nothing to setup :)")

@staticmethod
def get_vertex_variations() -> List[dataclasses.I3Position]:
Expand Down
4 changes: 3 additions & 1 deletion skymap_scanner/recos/millipede_original.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@ def __init__(self):
self.refine_time = False
self.add_fallback_position = False

def setup_reco(self):
def setup_reco(self, logger):
datastager = self.get_datastager()

datastager.stage_files(self.SPLINE_REQUIREMENTS)

abs_spline = datastager.get_filepath(self.MIE_ABS_SPLINE)
prob_spline = datastager.get_filepath(self.MIE_PROB_SPLINE)

logger.info("Starting I3PhotoSplineService...")
self.cascade_service = photonics_service.I3PhotoSplineService(abs_spline, prob_spline, timingSigma=0.0)
logger.info("Started I3PhotoSplineService.")

self.cascade_service.SetEfficiencies(self.SPEScale)

Expand Down
8 changes: 5 additions & 3 deletions skymap_scanner/recos/millipede_wilks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def __init__(self):

@staticmethod
def get_vertex_variations() -> List[dataclasses.I3Position]:
"""Returns a list of vectors referenced to the origin that will be used to generate the vertex position variations.
"""
"""Returns a list of vectors referenced to the origin that will be used
to generate the vertex position variations."""
return VertexGenerator.point()

def setup_reco(self):
def setup_reco(self, logger):
datastager = self.get_datastager()

datastager.stage_files(self.SPLINE_REQUIREMENTS)
Expand All @@ -70,6 +70,7 @@ def setup_reco(self):
effp_spline: str = datastager.get_filepath(self.FTP_EFFP_SPLINE)
tmod_spline: str = datastager.get_filepath(self.FTP_TMOD_SPLINE)

logger.info("Starting I3PhotoSplineService...")
self.cascade_service = photonics_service.I3PhotoSplineService(
abs_spline, prob_spline, timingSigma=0.0,
effectivedistancetable = effd_spline,
Expand All @@ -78,6 +79,7 @@ def setup_reco(self):
effectivedistancetableprob = effp_spline,
effectivedistancetabletmod = tmod_spline
)
logger.info("Started I3PhotoSplineService.")

self.muon_service = None

Expand Down
6 changes: 4 additions & 2 deletions skymap_scanner/recos/splinempe.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def extract_seed(frame):
def get_vertex_variations(self):
return VertexGenerator.cylinder()

def setup_reco(self):
def setup_reco(self, logger):
datastager = self.get_datastager()

datastager.stage_files(self.SPLINE_REQUIREMENTS)
Expand All @@ -274,6 +274,7 @@ def setup_reco(self):
StochTimingSpline: str = datastager.get_filepath(self.MIE_STOCH_PROB)
StochAmplitudeSpline: str = datastager.get_filepath(self.MIE_STOCH_ABS)

logger.info("Starting I3PhotoSplineServices...")
self.bare_mu_spline = I3PhotoSplineService(
BareMuAmplitudeSpline,
BareMuTimingSpline,
Expand All @@ -289,10 +290,11 @@ def setup_reco(self):
BareMuTimingSpline,
timingSigma=1000,
)
logger.info("Started I3PhotoSplineServices.")

@traysegment
def traysegment(self, tray, name, logger, **kwargs):
"""SplineMPE reco"""
"""SplineMPE reco."""

def checkName(frame: I3Frame, name: str) -> None:
if name not in frame:
Expand Down

0 comments on commit 5238055

Please sign in to comment.