diff --git a/vulcan_geometry.py b/vulcan_geometry.py index b1e6b5d..720191a 100644 --- a/vulcan_geometry.py +++ b/vulcan_geometry.py @@ -124,7 +124,7 @@ def add_bank(self, root, name, component_name, x, y, z, rot): # component component = le.SubElement(pack_root, 'component', type=component_name) # add location - self.addLocation(root=component, x=x, y=y, z=z, rot_y=rot, rot_z=rot) + self.addLocation(root=component, x=x, y=y, z=z, rot_y=rot, rot_z=0) return diff --git a/vulcan_x_geometry.py b/vulcan_x_geometry.py index 0a552e2..1b6382a 100644 --- a/vulcan_x_geometry.py +++ b/vulcan_x_geometry.py @@ -7,6 +7,9 @@ GAP = 10 VULCAN_L1 = 43. +PIXEL_WIDTH = 0.004145 +PIXEL_HEIGHT = 0.00301625 + class VulcanXIDFGenerator(object): """ @@ -140,6 +143,83 @@ def build_prototype_instrument(self): return + def build_vulcan_x_prototype(self): + """ + for McVine debugging + 1. 128 pixel tube + 2. + Returns: + + """ + # source + self._vulcan.addComment("SOURCE") + self._vulcan.addModerator(VULCAN_L1) + # sample + self._vulcan.addComment("SAMPLE") + self._vulcan.addSamplePosition() + # monitor + self._vulcan.addComment("MONITORS") + self._vulcan.add_monitor_type(self._geom_root) + # self._vulcan.addMonitors(distance=[-1.5077], names=["monitor1"]) + + # add detectors + self._vulcan.addComment('Define detector banks') + self._vulcan.addComponent(type_name='detectors', idlist='detectors') + # define detector type + self._vulcan.add_banks_type(root=self._geom_root, name='detectors', components=['bank1', 'bank2', 'bank5']) + + # west bank + self._vulcan.addComment('Define West Bank') + self._vulcan.add_bank(root=self._geom_root, name='bank1', component_name='pack_160tubes', + x=2.0, y=0., z=0., rot=90) + + # east bank + self._vulcan.addComment('Define West Bank') + self._vulcan.add_bank(root=self._geom_root, name='bank2', component_name='pack_160tubes', + x=-2.0, y=0., z=0., rot=-90) + + # high angle bank + self._vulcan.addComment('Define High Angle Bank') + self._vulcan.add_bank(root=self._geom_root, name='bank5', component_name='pack_72tubes', + x=2.*math.sin(150.*math.pi/180.), y=0., z=2.*math.cos(150.*math.pi/180.), rot=150.) + + # 20 x 8 packs + self._vulcan.addComment('20 x standard 8 packs') + self._vulcan.add_n_8packs_type(self._geom_root, name='pack_160tubes', num_tubes=160, tube_x=0.01, + num_tube_pixels=128) + + # single tube + self._vulcan.add_tube_type(self._geom_root, num_pixels=128, pixel_height=PIXEL_HEIGHT) + + # 9 x 8 packs + self._vulcan.addComment('9 x standard 8 packs') + self._vulcan.add_n_8packs_type(self._geom_root, name='pack_72tubes', num_tubes=72, tube_x=0.01, + num_tube_pixels=128) + + # single tube + # self._vulcan.add_tube_type(self._geom_root, num_pixels=128, pixel_height=PIXEL_WIDTH) + + # single pixel + self._vulcan.addComment('Cylinder Pixel In Tube') + self._vulcan.add_cylinder_pixel(self._geom_root, axis=(0, 1, 0), radius=PIXEL_WIDTH, height=PIXEL_HEIGHT) + + # monitor shape + self._vulcan.addComment('MONITOR SHAPE') + self._vulcan.add_cylinder_pixel(self._geom_root, axis=(0, 0, 1), radius=0.0047, height=0.008, is_monitor=True) + + # define detector IDs + self._vulcan.addComment('DETECTOR IDs') + num_pixels = 2 * 20 * 8 * 128 + 9 * 8 * 128 + self._vulcan.define_id_list(self._geom_root, id_name='detectors', start_id=0, end_id=num_pixels-1) + + # define monitor IDs + self._vulcan.addComment('MONITOR IDs') + self._vulcan.define_id_list(self._geom_root, id_name='monitors', start_id=None, end_id=None) + + # define detector parameters + self._vulcan.addComment('DETECTOR PARAMETERS') + self._vulcan.define_detector_parameters(self._geom_root) + def build_vulcan_x_phase1(self): """ build the IDF for VULCAN-X of phase 1 such that it will have 3 banks: west/east/high angle @@ -160,7 +240,7 @@ def build_vulcan_x_phase1(self): self._vulcan.addComment('Define detector banks') self._vulcan.addComponent(type_name='detectors', idlist='detectors') # define detector type - self._vulcan.add_banks_type(root=self._geom_root, name='detectors', components=['bank1']) #, 'bank4']) + self._vulcan.add_banks_type(root=self._geom_root, name='detectors', components=['bank1', 'bank2', 'bank5']) # west bank self._vulcan.addComment('Define West Bank') @@ -249,30 +329,30 @@ def build_complete_vulcan_x(self): x=-2.0, y=0., z=0., rot=-90) # bank 3 @ 135 - bank_angle = 135. + bank_angle = 120. self._vulcan.addComment('Define Bank 3') self._vulcan.add_bank(root=self._geom_root, name='bank3', component_name='pack_160tubes', x=2.0*math.sin(bank_angle*math.pi/180.), y=0., z=2.*math.cos(bank_angle*math.pi/180.), rot=bank_angle) # bank 4 @ 155 - bank_angle = 155. + bank_angle = 150. self._vulcan.addComment('Define Bank 4') self._vulcan.add_bank(root=self._geom_root, name='bank4', component_name='pack_160tubes', x=2.0*math.sin(bank_angle*math.pi/180.), y=0., z=2.*math.cos(bank_angle*math.pi/180.), rot=bank_angle) # bank 5 (old) high angle bank @ -150 - bank5_angle = -150. + bank5_angle = -155. self._vulcan.addComment('Define High Angle Bank at {}'.format(bank5_angle)) self._vulcan.add_bank(root=self._geom_root, name='bank5', component_name='pack_72tubes', x=2.*math.sin(bank5_angle*math.pi/180.), y=0., z=2.*math.cos(bank5_angle*math.pi/180.), rot=bank5_angle) # bank 6: - bank6_angle = -120. + bank6_angle = -65. self._vulcan.addComment('Define Bank 6 at {}'.format(bank6_angle)) - self._vulcan.add_bank(root=self._geom_root, name='bank6', component_name='pack_160tubes', + self._vulcan.add_bank(root=self._geom_root, name='bank6', component_name='pack_88tubes', x=2.*math.sin(bank6_angle*math.pi/180.), y=0., z=2.*math.cos(bank6_angle*math.pi/180.), rot=bank6_angle) @@ -289,6 +369,11 @@ def build_complete_vulcan_x(self): self._vulcan.add_n_8packs_type(self._geom_root, name='pack_72tubes', num_tubes=72, tube_x=0.01, num_tube_pixels=256) + # 11 x 8 packs + self._vulcan.addComment('11 x standard 8 packs') + self._vulcan.add_n_8packs_type(self._geom_root, name='pack_88tubes', num_tubes=88, tube_x=0.01, + num_tube_pixels=512) + # single tube self._vulcan.add_tube_type(self._geom_root, num_pixels=256, pixel_height=0.0063578125) @@ -302,7 +387,7 @@ def build_complete_vulcan_x(self): # define detector IDs self._vulcan.addComment('DETECTOR IDs') - num_pixels = 5 * 20 * 8 * 512 + 9 * 8 * 256 + num_pixels = 4 * 20 * 8 * 512 + + 1 * 11 * 8 * 512 + 9 * 8 * 256 self._vulcan.define_id_list(self._geom_root, id_name='detectors', start_id=0, end_id=num_pixels - 1) # define monitor IDs @@ -338,6 +423,12 @@ def main(): vulcan_simulator.export_idf('prototype_vulcan_x_sim.xml') elif True: + # concept of proof for phase 1 + vulcan_simulator = SimulationVulcanXIDFGenerator('2017-03-01 00:00:01', '2020-12-31 00:00:01') + vulcan_simulator.build_vulcan_x_prototype() + vulcan_simulator.export_idf('vulcan_x_concept_proof_phase1_sim.xml') + + elif False: # phase 1 vulcan_simulator = SimulationVulcanXIDFGenerator('2017-03-01 00:00:01', '2020-12-31 00:00:01') vulcan_simulator.build_vulcan_x_phase1() @@ -349,6 +440,8 @@ def main(): vulcan_simulator.build_complete_vulcan_x() vulcan_simulator.export_idf('vulcan_x_complete_sim.xml') + # END-IF-ELSE + if __name__ == '__main__': - main() \ No newline at end of file + main()