def __init__(self, config): super().__init__(config) self.phase = 'liquid' # To distinguish singlet/triplet time delay. if 'nest' in self.config['s1_model_type'] and (self.nestpy_calc is None): log.info( 'Using NEST for scintillation time without set calculator\n' 'Creating new nestpy calculator') self.nestpy_calc = nestpy.NESTcalc( nestpy.DetectorExample_XENON10()) # Check if user specified s1 model type exist S1VALIDTYPE = ['', 'simple', 'custom', 'optical_propagation', 'nest'] def s1_valid_type(s, c='+ ,'): if len(c) > 0: for k in s.split(c[0]): s1_valid_type(k, c[1:]) else: assert s in S1VALIDTYPE, f'Model type "{s}" not in {S1VALIDTYPE}' s1_valid_type(self.config['s1_model_type'])
def test_execNEST_random_xy(self): detector = nestpy.DetectorExample_XENON10() detector.Initialization() nestpy.execNEST(detector, 10, 'NR', 100., 120., 10., "-999, -999, 10.", "120", 1., 1, True, 1.0)
def test_xenon_example_constructor(self): detector = nestpy.DetectorExample_XENON10() assert detector is not None assert isinstance(detector, nestpy.DetectorExample_XENON10)
def test_execNEST_pos_random_seed(self): # test with actual position [0.,0.,0.] and randomSeed detector = nestpy.DetectorExample_XENON10() detector.Initialization() nestpy.execNEST(detector, 10, 'NR', 100., 120., 10., "0., 0., 10.", "120.", 1., 1, True, 1.0)
def test_execNEST_pos(self): # test with actual position [0.,0.,0.] and seed(1) detector = nestpy.DetectorExample_XENON10() detector.Initialization() nestpy.execNEST(detector, 10, 'NR', 100., 120., 10., "0., 0., 0.", "120.", 1., 1, False, 1.)
def test_execNEST_random_pos(self): # test with -1 for fObs and seed (1) detector = nestpy.DetectorExample_XENON10() detector.Initialization() nestpy.execNEST(detector, 10, 'NR', 100., 120., 10., "0., 0., 0.", "120.", -1., 1, False, 1.)
def test_nestcalc_get_xyresolution(self): self.detector = nestpy.DetectorExample_XENON10() self.detector.Initialization() self.nestcalc = nestpy.NESTcalc(self.detector) self.nestcalc.xyResolution( 0., 1.,2.)
import nestpy from nestpy.interaction_keys import GetInteractionObject # Figure parameters common throughout all plots version_textbox = " NEST v{0} \n nestpy v{1}".format(nestpy.__nest_version__, nestpy.__version__) bbox = dict(boxstyle="round", fc="1.00", edgecolor='none') params = { 'xtick.labelsize': 'x-large', 'ytick.labelsize': 'x-large', } # Updates plots to apply the above formatting to all plots in doc pylab.rcParams.update(params) # Detector identification detector = nestpy.DetectorExample_XENON10() # Performing NEST calculations according to the given detector example nc = nestpy.NESTcalc(detector) #Once you have interaction, you can get yields ''' Below are field and energy arrays. - Energies are broadcase to be repeated by the dimensions of the fields, owing to the nature of vectorized functions below. - Functions will loop over each energy and field simultaneously that way, rather than nesting for loops inside each other. ''' fields = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000] energies = np.logspace(-1, 4, 2000) energies = np.broadcast_to(energies, (len(fields), len(energies)))
def test_testNEST_random_xy(self): detector = nestpy.DetectorExample_XENON10() # test with actual position [0.,0.,0.] and randomSeed nestpy.testNEST(detector, 10, 'NR', 100., 120., 10., "-999, -999, 10.", "120", 1, 1, True)
def test_testNEST_pos(self): detector = nestpy.DetectorExample_XENON10() # test with actual position [0.,0.,0.] and seed(1) nestpy.testNEST(detector, 10, 'NR', 100., 120., 10., "0., 0., 10.", "120.", 1., 1, True)
def test_testNEST_random_pos(self): detector = nestpy.DetectorExample_XENON10() # test with -1 for fObs and seed (1) nestpy.testNEST(detector, 10, 'NR', 100., 120., 10., "0., 0., 0.", "120.", -1., 1, True)