boxAngles.append(firstBoxCenterAngle + i * (boxAngleWidth + boxGapAngle))

comment = """ This is the instrument definition file of the PANTHER spectrometer at the ILL.
       This file was automatically generated by mantidgeometry/ILL/IDF/panther_generateIDF.py
       """
validFrom = '1900-01-31 23:59:59'
geometry = MantidGeom(instrumentName, comment=comment, valid_from=validFrom)
geometry.addSnsDefaults(theta_sign_axis='x')
geometry.addComponentILL('fermi_chopper', 0.0, 0.0, -l1, 'Source')
geometry.addComponentILL('sample-position', 0.0, 0.0, 0.0, 'SamplePos')
geometry.addMonitors(names=['monitor'], distance=[monitorZ])
geometry.addDummyMonitor(0.01, 0.03)
geometry.addMonitorIds(['100000'])
geometry.addCylinderPixelAdvanced(
    'pixel', center_bottom_base={'x': 0., 'y': 0., 'z': -pixelHeight / 2.},
    axis={'x': 0., 'y': 1., 'z': 0.}, pixel_radius=pixelRadius,
    pixel_height=pixelHeight,
    algebra='pixel_shape')
root = geometry.getRoot()
bank = le.SubElement(root, 'type', name='bank')
tubes = le.SubElement(bank, 'component', type='tube')
for boxIndex, boxAngle in enumerate(boxAngles):
    for tubeIndex in range(numberOfTubesPerBox):
        tubeAngle = boxAngle - boxAngleWidth / 2. + tubeIndex * tubeAngleStep
        x = l2 * np.sin(np.deg2rad(tubeAngle))
        y = tubeVerticalShift
        z = l2 * np.cos(np.deg2rad(tubeAngle))
        attributes = {
            'x': str(x),
            'y': str(y),
            'z': str(z),
comment = """ This is the instrument definition file of the IN5 spectrometer at the ILL.
       This file was automatically generated by mantidgeometry/ILL/IDF/in5_generateIDF.py
       """
validFrom = '1900-01-31 23:59:59'
geometry = MantidGeom(instrumentName, comment=comment, valid_from=validFrom)
geometry.addSnsDefaults(theta_sign_axis='x')
geometry.addComponentILL('frame-overlap_chopper', 0.0, 0.0, frameOverlapChopperZ, 'Source')
geometry.addComponentILL('sample-position', 0.0, 0.0, 0.0, 'SamplePos')
geometry.addMonitors(names=['monitor'], distance=[monitorZ])
geometry.addDummyMonitor(0.01, 0.03)
geometry.addMonitorIds(['100000'])
pixelBase = {'x': 0., 'y': -tubePixelStep / 2., 'z': 0.}
geometry.addCylinderPixelAdvanced(
    'standard_pixel', center_bottom_base=pixelBase,
    axis={'x': 0., 'y': 1., 'z': 0.}, pixel_radius=pixelRadius,
    pixel_height=tubePixelStep,
    algebra='pixel_shape')
root = geometry.getRoot()
bank = le.SubElement(root, 'type', name='bank_uniq')
tubes = le.SubElement(bank, 'component', type='standard_tube')
for index, angle in enumerate(azimuthalAngle):
    attributes = {
        'r': str(radius),
        't': str(angle),
        'rot': str(angle),
        'axis-x': str(0.),
        'axis-y': str(1.),
        'axis-z': str(0.),
        'name': 'tube_{}'.format(index+1)
    }
       This file was automatically generated by mantidgeometry/ILL/IDF/sharp_generateIDF.py
       """
geometry = MantidGeom(instrumentName, comment=comment, valid_from=valid_from)
geometry.addSnsDefaults(theta_sign_axis='x')
geometry.addComponentILL('fermi_chopper', 0.0, 0.0, -l1, 'Source')
geometry.addComponentILL('sample-position', 0.0, 0.0, 0.0, 'SamplePos')
geometry.addMonitors(names=['monitor'], distance=[monitorZ])
geometry.addDummyMonitor(0.009, 0.036)  # the real radius is 0.09
geometry.addMonitorIds(['100000'])
geometry.addCylinderPixelAdvanced('pixel',
                                  center_bottom_base={
                                      'x': 0.,
                                      'y': -pixelHeight / 2.,
                                      'z': 0.
                                  },
                                  axis={
                                      'x': 0.,
                                      'y': 1.,
                                      'z': 0.
                                  },
                                  pixel_radius=pixelRadius,
                                  pixel_height=pixelHeight,
                                  algebra='pixel_shape')
root = geometry.getRoot()
detectorType = le.SubElement(root, 'type', name='detector')
tubes = le.SubElement(detectorType, 'component', type='tube')
for tubeIndex, tubeAngle in enumerate(tubeAngles):
    x = l2 * np.sin(-np.deg2rad(tubeAngle))
    z = l2 * np.cos(np.deg2rad(tubeAngle))
    attributes = {
        'x': str(x),
        'y': str(0.),
    tubeTheta = 0.5 * numberDetectors - j - detectorOffset
    detectorName = "pixel_%d" % (j + 1)
    rDetectors = rSampleDetectors
    if j % 2 != 0:  # detectors with even IDs are closer to the sample
        rDetectors -= tubeRadius
    else:
        tubeTheta -= intersectionAngle
    d7.addLocationPolar(root=bankComponent,
                        r=repr(rDetectors),
                        theta=repr(tubeTheta),
                        phi=repr(0),
                        name=detectorName)

# define pixel type
d7.addCylinderPixelAdvanced('pixel',
                            center_bottom_base={
                                'x': 0.,
                                'y': -tubeHeight / 2.,
                                'z': 0
                            },
                            axis={
                                'x': 0.,
                                'y': 1.,
                                'z': 0.
                            },
                            pixel_radius=tubeRadius,
                            pixel_height=tubeHeight,
                            algebra='cyl_approx')

d7.writeGeom(instrumentName + "_Definition.xml")