예제 #1
0
def test_damage_analysis_input_handling(dials_data, run_in_tmpdir):
    """Test that errors are handled if more than one refl file, no refl/expt
    file or unscaled data."""
    location = dials_data("l_cysteine_4_sweeps_scaled")
    refls = location.join("scaled_20_25.refl").strpath
    expts = location.join("scaled_20_25.expt").strpath

    # Too many refl files
    args = [refls, expts, refls]
    with pytest.raises(SystemExit):
        run(args)

    # No refl file
    args = [expts]
    with pytest.raises(SystemExit):
        run(args)

    # No expt file
    args = [refls]
    with pytest.raises(SystemExit):
        run(args)

    # Unscaled data
    location = dials_data("l_cysteine_dials_output")
    refls = location.join("20_integrated.pickle").strpath
    expts = location.join("20_integrated_experiments.json").strpath

    args = [refls, expts]
    with pytest.raises(SystemExit):
        run(args)
예제 #2
0
def test_damage_analysis_dials_data(dials_data, run_in_tmpdir):
    """Test dials.damage_analysis on scaled data."""
    location = dials_data("l_cysteine_4_sweeps_scaled")
    refls = location.join("scaled_20_25.refl").strpath
    expts = location.join("scaled_20_25.expt").strpath

    args = [
        refls,
        expts,
        "min_completeness=0.4",
        "-v",
        "json=dials.damage_analysis.json",
    ]
    run(args)
    assert os.path.isfile("dials.damage_analysis.html")
    assert os.path.isfile("dials.damage_analysis.json")
예제 #3
0
def test_damage_analysis_mtz(dials_data, run_in_tmpdir):
    """Test dials.damage_analysis on scaled data."""
    location = dials_data("l_cysteine_4_sweeps_scaled")
    refls = location.join("scaled_20_25.refl").strpath
    expts = location.join("scaled_20_25.expt").strpath

    # First export the data
    command = ["dials.export", refls, expts]
    result = procrunner.run(command)
    assert not result.returncode and not result.stderr
    assert os.path.isfile("scaled.mtz")

    args = [
        run_in_tmpdir.join("scaled.mtz").strpath,
        "anomalous=True",
        "json=dials.damage_analysis.json",
    ]
    run(args)
    assert os.path.isfile("dials.damage_analysis.html")
    assert os.path.isfile("dials.damage_analysis.json")