From a0d8033eb873f48a348d0f72b5e0ff171b954250 Mon Sep 17 00:00:00 2001 From: jlenain Date: Tue, 23 Jan 2024 16:45:45 +0100 Subject: [PATCH 1/3] Fix imports for camera geometry --- src/nectarchain/dqm/camera_monitoring.py | 7 ++++--- src/nectarchain/dqm/charge_integration.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nectarchain/dqm/camera_monitoring.py b/src/nectarchain/dqm/camera_monitoring.py index 3a698730..59a5279f 100644 --- a/src/nectarchain/dqm/camera_monitoring.py +++ b/src/nectarchain/dqm/camera_monitoring.py @@ -4,6 +4,7 @@ import numpy as np from astropy import time as astropytime from ctapipe.coordinates import EngineeringCameraFrame +from ctapipe.instrument import CameraGeometry from ctapipe.visualization import CameraDisplay from dqm_summary_processor import DQMSummary from matplotlib import pyplot as plt @@ -43,9 +44,9 @@ def ConfigureForRun(self, path, Pix, Samp, Reader1): try: # print(cursor.fetchall()) cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") - TempData = cursor.execute( - """SELECT * FROM monitoring_drawer_temperatures""" - ) + # TempData = cursor.execute( + # """SELECT * FROM monitoring_drawer_temperatures""" + # ) # print(TempData.description) self.DrawerTemp = cursor.fetchall() cursor.close() diff --git a/src/nectarchain/dqm/charge_integration.py b/src/nectarchain/dqm/charge_integration.py index 844791d0..7803f30d 100644 --- a/src/nectarchain/dqm/charge_integration.py +++ b/src/nectarchain/dqm/charge_integration.py @@ -2,6 +2,7 @@ import numpy as np from ctapipe.coordinates import EngineeringCameraFrame from ctapipe.image import LocalPeakWindowSum +from ctapipe.instrument import CameraGeometry from ctapipe.visualization import CameraDisplay from dqm_summary_processor import DQMSummary from matplotlib import pyplot as plt From 2dc1c5b52483a2530d872748edcec848c913be38 Mon Sep 17 00:00:00 2001 From: jlenain Date: Tue, 23 Jan 2024 16:46:15 +0100 Subject: [PATCH 2/3] Fix issue 83 --- src/nectarchain/dqm/start_dqm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nectarchain/dqm/start_dqm.py b/src/nectarchain/dqm/start_dqm.py index b375ee59..42d0bf76 100644 --- a/src/nectarchain/dqm/start_dqm.py +++ b/src/nectarchain/dqm/start_dqm.py @@ -50,8 +50,9 @@ if args.runnb is not None: # Grab runs automatically from DIRAC is the -r option is provided - from nectarchain.data.container import utils - dm = utils.DataManagement() + from nectarchain.data.management import DataManagement + + dm = DataManagement() _, filelist = dm.findrun(args.runnb) args.input_files = [s.name for s in filelist] elif args.input_files is None: From 386c63fc0fb74a8405afe31072ddcbf742de6722 Mon Sep 17 00:00:00 2001 From: jlenain Date: Tue, 23 Jan 2024 16:47:14 +0100 Subject: [PATCH 3/3] Fix issue 83 in user script --- .../submitGainFitDIRAC/submitGainFitter.py | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/nectarchain/user_scripts/jlenain/submitGainFitDIRAC/submitGainFitter.py b/src/nectarchain/user_scripts/jlenain/submitGainFitDIRAC/submitGainFitter.py index a65113f1..ed7af1b6 100755 --- a/src/nectarchain/user_scripts/jlenain/submitGainFitDIRAC/submitGainFitter.py +++ b/src/nectarchain/user_scripts/jlenain/submitGainFitDIRAC/submitGainFitter.py @@ -2,66 +2,65 @@ # -*- coding: utf-8 -*- import argparse -import sys import logging +import sys from time import sleep # astropy imports from astropy import time -# nectarchain imports -from nectarchain.data.container.utils import DataManagement as dm - # DIRAC imports from DIRAC.Interfaces.API.Dirac import Dirac from DIRAC.Interfaces.API.Job import Job from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient -logging.basicConfig(format='[%(levelname)s] %(message)s') +# nectarchain imports +from nectarchain.data.management import DataManagement as dm + +logging.basicConfig(format="[%(levelname)s] %(message)s") logger = logging.getLogger(__name__) dirac = Dirac() # Option and argument parser parser = argparse.ArgumentParser() -parser.add_argument('-r', '--runs', - default=None, - help='list of runs to process', - nargs='+', - type=int) -parser.add_argument('--log', - default=logging.INFO, - help='debug output', - type=str) +parser.add_argument( + "-r", "--runs", default=None, help="list of runs to process", nargs="+", type=int +) +parser.add_argument("--log", default=logging.INFO, help="debug output", type=str) args = parser.parse_args() if not args.runs: - logger.critical('A run, or list of runs, should be provided.') + logger.critical("A run, or list of runs, should be provided.") sys.exit(1) logger.setLevel(args.log) -executable_wrapper="GainFitter.sh" -sandboxlist = [f'{executable_wrapper}'] +executable_wrapper = "GainFitter.sh" +sandboxlist = [f"{executable_wrapper}"] # Get run file list from DIRAC for run in args.runs: lfns = dm.get_GRID_location(run) for lfn in lfns: - sandboxlist.append(f'LFN:{lfn}') + sandboxlist.append(f"LFN:{lfn}") # Now, submit the DIRAC jobs: j = Job() -j.setExecutable(f'{executable_wrapper}') +j.setExecutable(f"{executable_wrapper}") # Force job to be run from a given Computing Element: # j.setDestination('LCG.GRIF.fr') -j.setName(f'NectarCAM Gain fitter') +j.setName(f"NectarCAM Gain fitter") # j.setNumberOfProcessors(minNumberOfProcessors=2) -j.setJobGroup('nectarchain gain') -logger.info(f'''Submitting job, with the following InputSandbox: +j.setJobGroup("nectarchain gain") +logger.info( + f"""Submitting job, with the following InputSandbox: {sandboxlist} -''') +""" +) j.setInputSandbox(sandboxlist) -res = dirac.submitJob(j) # , mode='local') # for local execution, simulating a DIRAC job on the local machine, instead of submitting it to a DIRAC Computing Element +res = dirac.submitJob( + j +) # , mode='local') # for local execution, simulating a DIRAC job on the local machine, instead of submitting it to a DIRAC Computing Element logger.info(f"Submission Result: {res['Value']}")