예제 #1
0
def sensor_thickness_from_minicbf(img):
    header = cbf.get_pilatus_header(img)
    sensor = filter(lambda x: "sensor, thick" in x, header.splitlines())[0]
    thick, unit = sensor[sensor.index("thickness ")+len("thickness "):].split()
    assert unit == "m"

    return float(thick) * 1.e3
예제 #2
0
def sensor_thickness_from_minicbf(img):
    header = cbf.get_pilatus_header(img)
    sensor = filter(lambda x: "sensor, thick" in x, header.splitlines())[0]
    thick, unit = sensor[sensor.index("thickness ") +
                         len("thickness "):].split()
    assert unit == "m"

    return float(thick) * 1.e3
def sfx_xds_inp(img_in, xdsinp, params):
    import pycbf

    os.symlink(img_in, os.path.join(os.path.dirname(xdsinp), "data_10000.cbf"))

    header = cbf.get_pilatus_header(img_in)
    sensor = filter(lambda x: "Wavelength" in x, header.splitlines())[0]
    wavelength, unit = sensor[sensor.index("Wavelength ")+len("Wavelength "):].split()
    assert unit == "A"

    orgx, orgy = params.orgx, params.orgy
    if orgx is None: orgx = 0
    if orgy is None: orgy = 0

    if params.rotation_axis is not None:
        rotation_axis = " ".join(map(lambda x: "%.2f"%x, params.rotation_axis))
    else:
        rotation_axis = "1 0 0"

    # Reference: http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/Generate_XDS.INP
    inpstr = """\
JOB= COLSPOT IDXREF DEFPIX INTEGRATE CORRECT
ORGX= %(orgx).2f ORGY= %(orgy).2f
DETECTOR_DISTANCE= 0
OSCILLATION_RANGE= %(osc_range).5f
X-RAY_WAVELENGTH= %(wavelength)f
NAME_TEMPLATE_OF_DATA_FRAMES=data_?????.cbf
DATA_RANGE=10000 10000

SPACE_GROUP_NUMBER= 0 ! 16
UNIT_CELL_CONSTANTS= 48.3392 77.1339 84.7324 90 90 90
INCLUDE_RESOLUTION_RANGE=50 0  ! after CORRECT, insert high resol limit; re-run CORRECT

FRIEDEL'S_LAW=FALSE     ! This acts only on the CORRECT step

! parameters with changes wrt default values:
TRUSTED_REGION=0.0 2 ! partially use corners of detector (0 1.4143: use all pixels)
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok
STRONG_PIXEL=2           ! COLSPOT: only use strong reflections (default is 3)
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=2 ! default of 6 is sometimes too high
! close spots/long cell axis: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3
! SEPMIN=4  CLUSTER_RADIUS=2 ! should be default for Pilatus and other detectors with low PSF
! since XDS 01-MAR-2015, POSITION is used instead of DISTANCE. Older versions do it the other way round.
REFINE(IDXREF)=CELL BEAM ORIENTATION  AXIS ! DISTANCE POSITION
REFINE(INTEGRATE)= DISTANCE POSITION BEAM ORIENTATION ! AXIS CELL
! REFINE(CORRECT)=CELL BEAM ORIENTATION AXIS DISTANCE POSITION ! Default is: refine everything

! parameters specifically for this detector and beamline:
DETECTOR= PILATUS MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD= 1048576  !PILATUS
SENSOR_THICKNESS= 0.05
! attention CCD detectors: for very high resolution (better than 1A) make sure to specify SILICON
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon)
NX= 512 NY= 8192  QX= 0.05   QY= 0.05  ! to make CORRECT happy if frames are unavailable

ROTATION_AXIS=%(rotation_axis)
 DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
 DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
INCIDENT_BEAM_DIRECTION=0 0 1
FRACTION_OF_POLARIZATION=0.98   ! better value is provided by beamline staff!
POLARIZATION_PLANE_NORMAL=0 1 0

""" % dict(osc_range=params.sfx.osc_range,
           wavelength=float(wavelength),
           orgx=orgx, orgy=orgy,
           rotation_axis=rotation_axis)

    from yamtbx.dataproc.crystfel.command_line.geom_for_xds import geom_to_xdsinp_str

    geom = crystfel.geom.Geomfile(params.sfx.crystfel_geom)
    if params.sfx.clen is not None: geom.clen = params.sfx.clen

    inpstr += geom_to_xdsinp_str(geom)

    return inpstr
def sfx_xds_inp(img_in, xdsinp, params):
    import pycbf

    os.symlink(img_in, os.path.join(os.path.dirname(xdsinp), "data_10000.cbf"))

    header = cbf.get_pilatus_header(img_in)
    sensor = filter(lambda x: "Wavelength" in x, header.splitlines())[0]
    wavelength, unit = sensor[sensor.index("Wavelength ") + len("Wavelength ") :].split()
    assert unit == "A"

    orgx, orgy = params.orgx, params.orgy
    if orgx is None:
        orgx = 0
    if orgy is None:
        orgy = 0

    if params.rotation_axis is not None:
        rotation_axis = " ".join(map(lambda x: "%.2f" % x, params.rotation_axis))
    else:
        rotation_axis = "1 0 0"

    # Reference: http://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/Generate_XDS.INP
    inpstr = """\
JOB= COLSPOT IDXREF DEFPIX INTEGRATE CORRECT
ORGX= %(orgx).2f ORGY= %(orgy).2f
DETECTOR_DISTANCE= 0
OSCILLATION_RANGE= %(osc_range).5f
X-RAY_WAVELENGTH= %(wavelength)f
NAME_TEMPLATE_OF_DATA_FRAMES=data_?????.cbf
DATA_RANGE=10000 10000

SPACE_GROUP_NUMBER= 0 ! 16
UNIT_CELL_CONSTANTS= 48.3392 77.1339 84.7324 90 90 90
INCLUDE_RESOLUTION_RANGE=50 0  ! after CORRECT, insert high resol limit; re-run CORRECT

FRIEDEL'S_LAW=FALSE     ! This acts only on the CORRECT step

! parameters with changes wrt default values:
TRUSTED_REGION=0.0 2 ! partially use corners of detector (0 1.4143: use all pixels)
VALUE_RANGE_FOR_TRUSTED_DETECTOR_PIXELS=6000. 30000. ! often 7000 or 8000 is ok
STRONG_PIXEL=2           ! COLSPOT: only use strong reflections (default is 3)
MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=2 ! default of 6 is sometimes too high
! close spots/long cell axis: reduce SEPMIN and CLUSTER_RADIUS from their defaults of 6 and 3
! SEPMIN=4  CLUSTER_RADIUS=2 ! should be default for Pilatus and other detectors with low PSF
! since XDS 01-MAR-2015, POSITION is used instead of DISTANCE. Older versions do it the other way round.
REFINE(IDXREF)=CELL BEAM ORIENTATION  AXIS ! DISTANCE POSITION
REFINE(INTEGRATE)= DISTANCE POSITION BEAM ORIENTATION ! AXIS CELL
! REFINE(CORRECT)=CELL BEAM ORIENTATION AXIS DISTANCE POSITION ! Default is: refine everything

! parameters specifically for this detector and beamline:
DETECTOR= PILATUS MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD= 1048576  !PILATUS
SENSOR_THICKNESS= 0.05
! attention CCD detectors: for very high resolution (better than 1A) make sure to specify SILICON
! as about 32* what CORRECT.LP suggests (absorption of phosphor is much higher than that of silicon)
NX= 512 NY= 8192  QX= 0.05   QY= 0.05  ! to make CORRECT happy if frames are unavailable

ROTATION_AXIS=%(rotation_axis)
 DIRECTION_OF_DETECTOR_X-AXIS=1 0 0
 DIRECTION_OF_DETECTOR_Y-AXIS=0 1 0
INCIDENT_BEAM_DIRECTION=0 0 1
FRACTION_OF_POLARIZATION=0.98   ! better value is provided by beamline staff!
POLARIZATION_PLANE_NORMAL=0 1 0

""" % dict(
        osc_range=params.sfx.osc_range, wavelength=float(wavelength), orgx=orgx, orgy=orgy, rotation_axis=rotation_axis
    )

    from yamtbx.dataproc.crystfel.command_line.geom_for_xds import geom_to_xdsinp_str

    geom = crystfel.geom.Geomfile(params.sfx.crystfel_geom)
    if params.sfx.clen is not None:
        geom.clen = params.sfx.clen

    inpstr += geom_to_xdsinp_str(geom)

    return inpstr