def test1(self): 'detector hierarchy from xml' from instrument.nixml import parse_file instrument = parse_file( 'ARCS.xml' ) import instrument.geometers as ig instrument.geometer.changeRequestCoordinateSystem( ig.coordinateSystem( coordinate_system ) ) assignLocalGeometers( instrument, coordinate_system = coordinate_system ) detectorSystem = instrument.getDetectorSystem() tofparams = 0, 10e-3, 1e-4 detectorSystem.tofparams = tofparams dims = getDetectorHierarchyDimensions( instrument ) dims = [ dim for name, dim in dims ] mca = md.eventModeMCA( outfilename, dims ) detectorSystem.mca = mca cds = mh.scattererEngine( detectorSystem, coordinate_system = coordinate_system ) for i in range(nevents): if i%1000 == 0: print i ev = mcni.neutron( r = (0,0,0), v = (1500,0,2000) ) cds.scatter(ev) continue instrument.geometer = instrument.global_geometer return
def test1(self): 'detector hierarchy from xml' from instrument.nixml import parse_file instrument = parse_file('ARCS.xml') import instrument.geometers as ig instrument.geometer.changeRequestCoordinateSystem( ig.coordinateSystem(coordinate_system)) assignLocalGeometers(instrument, coordinate_system=coordinate_system) detectorSystem = instrument.getDetectorSystem() tofparams = 0, 10e-3, 1e-4 detectorSystem.tofparams = tofparams dims = getDetectorHierarchyDimensions(instrument) dims = [dim for name, dim in dims] mca = md.eventModeMCA(outfilename, dims) detectorSystem.mca = mca cds = mh.scattererEngine(detectorSystem, coordinate_system=coordinate_system) for i in range(nevents): if i % 1000 == 0: print i ev = mcni.neutron(r=(0, 0, 0), v=(2000, 1500, 0)) cds.scatter(ev) continue instrument.geometer = instrument.global_geometer return
def detectorcomponent(name, instrumentxml, coordinate_system, tofparams, outfilename): import mccomposite.extensions.Copy import mccomposite.extensions.HollowCylinder import mccomponents.detector.optional_extensions.Detector from instrument.nixml import parse_file instrument = parse_file(instrumentxml) import instrument.geometers as ig instrument.geometer.changeRequestCoordinateSystem( ig.coordinateSystem(coordinate_system)) from mccomponents.detector.utils import \ getDetectorHierarchyDimensions, assignLocalGeometers assignLocalGeometers(instrument, coordinate_system=coordinate_system) detectorSystem = instrument.getDetectorSystem() detectorSystem.tofparams = tofparams dims = getDetectorHierarchyDimensions(instrument) dims = [dim for name, dim in dims] mca = eventModeMCA(outfilename, dims) detectorSystem.mca = mca import mccomponents.homogeneous_scatterer as mh cds = mh.scattererEngine(detectorSystem, coordinate_system=coordinate_system) instrument.geometer = instrument.global_geometer cds.name = name return cds
def render(self, instrument, coordinate_system = 'McStas'): from instrument.geometers import coordinateSystem self._cs = coordinateSystem( coordinate_system ) self.global_geometer = instrument.global_geometer = instrument.geometer instrument.identify(self) del self.global_geometer return
def render(self, instrument, coordinate_system="McStas"): from instrument.geometers import coordinateSystem self._cs = coordinateSystem(coordinate_system) self.global_geometer = instrument.global_geometer = instrument.geometer instrument.identify(self) del self.global_geometer return