From bb23d5c79954d4e4b9fcaa13e4710ceb752e085d Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Tue, 8 Jan 2019 16:47:16 -0500 Subject: [PATCH] Refs #113. Checkpointing progress on HB2B calibration file. --- hb2b_geometry.py | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/hb2b_geometry.py b/hb2b_geometry.py index 5e35392..f65d271 100644 --- a/hb2b_geometry.py +++ b/hb2b_geometry.py @@ -16,7 +16,7 @@ 'L2': 0.416, # arm length 'PixelNumber': {'1K': (1024, 1024), '2K': (2048, 2048)}, 'PixelSize': {'1K': 0.0004000, '2K': 0.0004000*0.5} - } + } class HB2BGeometry(helper.MantidGeom): @@ -35,6 +35,28 @@ def __init__(self, instname, comment=None, valid_from=None, valid_to=None): return + def add_rectangular_detector(self, x_start, x_step, x_pixels, + y_start, y_step, y_pixels, + pixel_size_x, pixel_size_y, pixel_size_z): + """ + """ + # add detector panel + self.addRectangularDetector(name='panel', type='pixel', + xstart='{}'.format(x_start), xstep='{}'.format(x_step), + xpixels='{}'.format(x_pixels), + ystart='{}'.format(y_start), ystep='{}'.format(y_step), + ypixels='{}'.format(y_pixels)) + + # add pixels + self.addCuboidPixel(name='pixel', shape_id='pixel-shape', + lfb_pt=(pixel_size_x*0.5, -pixel_size_y*0.5, 0), # left-front-bottom + lft_pt=(pixel_size_x*0.5, pixel_size_y*0.5, 0), # left-front-top + lbb_pt=(pixel_size_x*0.5, -pixel_size_y*0.5, -pixel_size_z), # left-back-bottom + rfb_pt=(-pixel_size_x*0.5, -pixel_size_y*0.5, 0) # right-front-bottom + ) + + return + # END-DEF-HB3A @@ -90,11 +112,11 @@ def generate_1bank_2d_idf(instrument_name, geom_setup_dict, pixel_setup, output_ x_step = - pixel_size_x y_start = -(float(pixel_row_count)*0.5 - 0.5) * pixel_size_y y_step = pixel_size_y - hb2b.addRectangularDetector(name='panel', type='pixel', - xstart='{}'.format(x_start), xstep='{}'.format(x_step), - xpixels='{}'.format(pixel_column_count), - ystart='{}'.format(y_start), ystep='{}'.format(y_step), - ypixels='{}'.format(pixel_row_count)) + hb2b.add_rectangular_detector(x_start=x_start, x_step=x_step, x_pixels=pixel_column_count, + y_start=y_start, y_step=y_step, y_pixels=pixel_row_count, + pixel_size_x=pixel_size_x, pixel_size_y=pixel_size_y, + pixel_size_z=0.0001) + hb2b.write_terminal()