Ejemplo n.º 1
0
def test_single_deprecation(image_test_dir):
    """Test out the ScanFactory."""

    with pytest.warns(DeprecationWarning):
        ScanFactory.single(
            scan_helper_image_files.template_directory_index_to_image(
                "image_###.dat", image_test_dir, 2
            ),
            None,
            1.0,
            18 + 0.5,
            0.5,
            1,
        )
Ejemplo n.º 2
0
def work_xScanFactory():
    '''Test out the ScanFactory.'''

    import dxtbx
    directory = os.path.join(os.path.split(dxtbx.__file__)[0], 'tests')

    template = 'image_###.dat'

    xscans = [
        ScanFactory.single(
            scan_helper_image_files.template_directory_index_to_image(
                template, directory, j + 1),
            scan_helper_image_formats.FORMAT_CBF, 1.0, 18 + 0.5 * j, 0.5, j)
        for j in range(20)
    ]

    xscans.reverse()

    try:
        print sum(xscans[1:], xscans[0])
        print 'I should not see this message'
    except RuntimeError:
        pass

    xscans.sort()

    sum(xscans[1:], xscans[0])

    a = ScanFactory.add(xscans[:10])
    b = ScanFactory.add(xscans[10:])

    a + b

    filename = scan_helper_image_files.template_directory_index_to_image(
        template, directory, 1)

    assert (len(ScanFactory.search(filename)) == 20)

    (a + b)[1:5]
    (a + b)[:10]

    cbf = os.path.join(directory, 'phi_scan_001.cbf')

    print 'OK'
Ejemplo n.º 3
0
def test_xScanFactory():
    """Test out the ScanFactory."""

    import dxtbx

    directory = os.path.join(os.path.split(dxtbx.__file__)[0], "tests")

    template = "image_###.dat"

    xscans = [
        ScanFactory.single(
            scan_helper_image_files.template_directory_index_to_image(
                template, directory, j + 1),
            scan_helper_image_formats.FORMAT_CBF,
            1.0,
            18 + 0.5 * j,
            0.5,
            j,
        ) for j in range(20)
    ]

    xscans.reverse()

    with pytest.raises(RuntimeError):
        print(sum(xscans[1:], xscans[0]))

    xscans.sort()

    sum(xscans[1:], xscans[0])

    a = ScanFactory.add(xscans[:10])
    b = ScanFactory.add(xscans[10:])

    a + b

    filename = scan_helper_image_files.template_directory_index_to_image(
        template, directory, 1)

    assert len(ScanFactory.search(filename)) == 20

    (a + b)[1:5]
    (a + b)[:10]
Ejemplo n.º 4
0
def work_xScanFactory():
  '''Test out the ScanFactory.'''

  import dxtbx
  directory = os.path.join(os.path.split(dxtbx.__file__)[0], 'tests')

  template = 'image_###.dat'

  xscans = [ScanFactory.single(
      scan_helper_image_files.template_directory_index_to_image(
          template, directory, j + 1), scan_helper_image_formats.FORMAT_CBF,
      1.0, 18 + 0.5 * j, 0.5, j) for j in range(20)]

  xscans.reverse()

  try:
    print sum(xscans[1:], xscans[0])
    print 'I should not see this message'
  except RuntimeError, e:
    pass