예제 #1
0
jinfo = dict(curved_array='wing_detector',  # name of the wing detector
             curved_panel_types=dict(front='front-wing-panel',
                                     back='back-wing-panel'),
             number_eightpacks=20,
             bank_radius=1.129538,
             anchor_offset=0.0,
             eightpack_angle=2.232094,
             panel_translation_log_key='detectorZ')

iinfo.update(jinfo)
r_eightpack = iinfo['bank_radius'] + iinfo['anchor_offset']
comment = f'Panel is positioned {r_eightpack} meters downstream'
kwargs = dict(comment=comment, to_origin=False, first_bank_number=1 + last_bank_number)
double_panel = add_double_curved_panel_type(det, iinfo, **kwargs)
pixel_idlist = 'curved_panel_ids'
double_panel = add_double_curved_panel_component(double_panel, pixel_idlist, det, iinfo['curved_array'])
# Rotate the double panel away from the path of the Z-axis
rot_y = - iinfo['eightpack_angle'] * iinfo['number_eightpacks'] / 2
rot_y += 0.5 * iinfo['fourpack_slip'] / jinfo['bank_radius'] * 180. / math.pi
det.addLocation(double_panel, 0., 0., 0, rot_y=f'{rot_y:.2f}')
insert_location_from_logs(double_panel, log_key=['ww_rot_Readback', 'ww_rot_Readback'],
                          coord_name=['t-position', 'roty'], equation=[f'{rot_y:.2f}-value', f'{rot_y:.2f}-value'])


add_double_panel_idlist(det, iinfo, pixel_idlist, start=1 + last_pixel_id)

#
# Write to file
#
det.writeGeom(fn)
    vulcan_geom.addMonitors(distance=[4.83, 1.50],
                            names=["monitor2", "monitor3"])

    # -- ADD BANKS --
    # NOTE:
    # To compensate for the curved (1,2,3,4,6) and flat (5) banks, the actual
    # physical positions is stored at the eight-pack level.
    # The bank here is set to (0,0,0) with zero rotations.
    logging.info(f"Add Banks")
    bank_ids = df["bank"].unique()
    lb_pos = ["X", "Y", "Z"]

    for bank_id in bank_ids:
        elem_bank = vulcan_geom.addComponent(type_name=f"bank{bank_id}",
                                             idlist=f"bank{bank_id}")
        vulcan_geom.addLocation(elem_bank, x=0, y=0, z=0, rot_y=0)

    # -- ADD 8PACKS --
    # NOTE:
    # Assume that the given csv files contains measurements for all eight-packs in each bank
    logging.info(f"Add 8-packs")
    for bank_id in bank_ids:
        # select bank
        bk = df[df["bank"] == bank_id]
        # make top element
        elem_bank = vulcan_geom.makeTypeElement(f"bank{bank_id}")
        # add individual eight packs based on measurements
        eightpack_ids = bk["eightpack"].unique()
        type_name = "eightpackshort" if bank_id == 5 else "eightpack"
        for eightpack_id in eightpack_ids:
            ep = bk[bk["eightpack"] == eightpack_id].sort_values(
geometry.addModerator(distance=ch12, name="chopper")
geometry.addMonitors(names=["monitor"], distance=[mon], neutronic=args.geometrytype != 'N')
geometry.addDummyMonitor(0.001, 0.001)
geometry.addMonitorIds([0])
geometry.addComponent("single_detectors", "single_detectors")
sds = geometry.makeTypeElement("single_detectors")
sdc = geometry.addComponent("single_pixel", root=sds, blank_location=False)
r = 2*analyser+psd
for i in range(len(SD_azimuths)):
    t=SD_azimuths[i]* pi/180.
    x = - psd * sin(t)
    y = 0.
    z = - psd * cos(t)
    nx, ny, nz = mirror(x, y, z)
    if args.geometrytype == 'N':
        geometry.addLocation(root=sdc, x=nx, y=ny, z=nz, name="single_tube_{0}".format(i+1))
    else:
        geometry.addLocation(root=sdc, x=x, y=y, z=z, nx=nx, ny=ny, nz=nz, name="single_tube_{0}".format(i+1), neutronic=True)
geometry.addComponent("psds", "psds")
psds = geometry.makeTypeElement("psds")
psdc = geometry.addComponent("single_pixel", root=psds, blank_location=False)
for i in range(len(PSD_azimuths)):
    t = PSD_azimuths[i]*pi/180.
    x = - psd * sin(t)
    z = - psd * cos(t)
    for p in range(pixels):
        y = -height/2 + p * height/pixels
        nx, ny, nz = mirror(x, y, z)
        if args.geometrytype == 'N':
            geometry.addLocation(root=psdc, x=nx, y=ny, z=nz, name="tube_{0}_pixel_{1}".format(i+1, p+1))
        else:
detector = in16b.makeTypeElement("detector")

# create tubes id lists
for i in range(number_of_tubes):
    in16b.addDetectorIds("tube_{0}_ids".format(i + 1),
                         [pixel_per_tube * i + 1, pixel_per_tube * (i + 1), 1])

# create standard tube component and place them
tube = in16b.makeTypeElement("tube")
for i in range(number_of_tubes):
    current_tube = in16b.addComponent('tube',
                                      idlist="tube_{0}_ids".format(i + 1),
                                      root=detector)
    in16b.addLocation(root=current_tube,
                      x=0,
                      y=pow(-1, i) * vertical_offset,
                      z=0,
                      rot_y=-tube_angles[i],
                      name="tube_{0}".format(i + 1))

# add a pixel component to the tube component
tube_pixel = in16b.addComponent(root=tube, type_name='pixel')

# place pixels on the standard tube component
for i in range(pixel_per_tube):
    in16b.addLocation(root=tube_pixel,
                      x=(pixel_per_tube // 2 - i) / pixel_per_tube *
                      tube_width,
                      y=0,
                      z=distance_to_sample,
                      name="pixel_{0}".format(i + 1))
예제 #5
0
geometry.addMonitorIds([0])
geometry.addComponent("single_detectors",
                      "single_detectors",
                      blank_location=False)
sds = geometry.makeTypeElement("single_detectors")
sdc = geometry.addComponent("single_pixel", root=sds)
for i in range(len(SD_azimuths)):
    t = SD_azimuths[i] * pi / 180.
    x = sd * sin(t)
    y = 0.
    z = -sd * cos(t)
    nx, ny, nz = mirror(x, y, z, sd_analyser)
    if args.geometrytype == 'N':
        geometry.addLocation(root=sdc,
                             x=nx,
                             y=ny,
                             z=nz,
                             name="single_tube_{0}".format(i + 1))
    else:
        geometry.addLocation(root=sdc,
                             x=x,
                             y=y,
                             z=z,
                             nx=nx,
                             ny=ny,
                             nz=nz,
                             name="single_tube_{0}".format(i + 1),
                             neutronic=True)
geometry.addComponent("psds", "psds", blank_location=False)
psds = geometry.makeTypeElement("psds")
psdc = geometry.addComponent("single_pixel", root=psds)
d7.addComponentILL("detector", 0., 0., 0.)
detector = d7.makeTypeElement("detector")

# define detector banks
d7.addDetectorIds("bank2_ids", [1, 44, 1])
d7.addDetectorIds("bank3_ids", [45, 88, 1])
d7.addDetectorIds("bank4_ids", [89, 132, 1])
bank = d7.makeTypeElement("bank")
bank2 = d7.addComponent("bank", idlist="bank2_ids", root=detector)
bank3 = d7.addComponent("bank", idlist="bank3_ids", root=detector)
bank4 = d7.addComponent("bank", idlist="bank4_ids", root=detector)

# define detector banks initial positions
d7.addLocation(root=bank2,
               x=0,
               y=0,
               z=0,
               rot_y=repr(-(minTwoTheta + 0.5 * numberDetectors)),
               name="bank2")
d7.addLocation(root=bank3,
               x=0,
               y=0,
               z=0,
               rot_y=repr(-(minTwoTheta + 1.5 * numberDetectors + 2)),
               name="bank3")
d7.addLocation(root=bank4,
               x=0,
               y=0,
               z=0,
               rot_y=repr(-(maxTwoTheta - 0.5 * numberDetectors)),
               name="bank4")