From 4c68284e0030ea41a0b1b75b96ce279676c45438 Mon Sep 17 00:00:00 2001 From: Jiao Lin Date: Sat, 23 Oct 2021 05:42:23 -0700 Subject: [PATCH 1/2] new file from Gabriele: LET/detector_system/LET_Definition.xml --- LET/detector_system/LET_Definition.xml | 717 +++++++++++++++++++++++++ 1 file changed, 717 insertions(+) create mode 100644 LET/detector_system/LET_Definition.xml diff --git a/LET/detector_system/LET_Definition.xml b/LET/detector_system/LET_Definition.xml new file mode 100644 index 0000000..7080cc1 --- /dev/null +++ b/LET/detector_system/LET_Definition.xml @@ -0,0 +1,717 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6c6e4ebdcf41e431dfb247d6413e79c21ce7d71b Mon Sep 17 00:00:00 2001 From: Jiao Lin Date: Mon, 25 Oct 2021 08:38:04 -0700 Subject: [PATCH 2/2] LET/detector_system: new mantid xml file from Gabriele that works with mantid2mcvine --- LET/detector_system/LET_detector_2021.xml | 1297 +++++++++++++++++++++ LET/detector_system/convert_det_system.py | 42 + 2 files changed, 1339 insertions(+) create mode 100644 LET/detector_system/LET_detector_2021.xml create mode 100755 LET/detector_system/convert_det_system.py diff --git a/LET/detector_system/LET_detector_2021.xml b/LET/detector_system/LET_detector_2021.xml new file mode 100644 index 0000000..0ee2a49 --- /dev/null +++ b/LET/detector_system/LET_detector_2021.xml @@ -0,0 +1,1297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LET/detector_system/convert_det_system.py b/LET/detector_system/convert_det_system.py new file mode 100755 index 0000000..de60c9e --- /dev/null +++ b/LET/detector_system/convert_det_system.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# coding: utf-8 + +# Convert detector systems from mantid xml to mcvine +# + +import os, sys, shutil +import mantid +import numpy as np + +# ## Create workflow +workdir = os.path.expanduser('~/simulations/LET/detsys') +if not os.path.exists(workdir): + os.makedirs(workdir) + +#!rm -rf {workdir}/* +os.chdir(workdir) + +# ## Convert +import mantid2mcvine as m2m +shutil.copyfile( + '/home/97n/dv/mcvine/instruments/LET/detector_system/LET_detector_2021.xml', + 'LET_Definition_10232021.xml') + +mantid_idf = "LET_Definition_10232021.xml" +# output +mcvine_idf = 'LET_mcvine_10232021.xml' +template_nxs = 'LET_template_10232021.nxs' +tofbinsize = 0.1 # mus + +detsys_shape = m2m.shapes.hollowCylinder(in_radius=3., out_radius=4., height=5.) # meters +im = m2m.InstrumentModel( + instrument_name='LET', beamline=2199, + mantid_idf=mantid_idf, mcvine_idf=mcvine_idf, template_nxs=template_nxs, + detsys_shape=detsys_shape, mantid_idf_monitor_tag = 'monitors', + tofbinsize = tofbinsize, + ) +im.convert() + +import yaml +with open('LET_instrument_model_10232021.yaml', 'wt') as stream: + yaml.safe_dump(im.todict(), stream)