Пример #1
0
def test_get_fills_split_filling_scheme_big_range():
    fills = oms.get_fills(6000, 7000, split_filling_scheme=True)
    assert len(fills) > 4
    fill = fills[0]

    assert "injection_scheme" in fill
    assert "injection_scheme_spacing" in fill
Пример #2
0
def test_get_fills():
    fills = oms.get_fills(7480, 7483)
    assert len(fills) == 4
    assert fills[0]["fill_number"] == 7480
    assert fills[1]["fill_number"] == 7481
    assert fills[2]["fill_number"] == 7482
    assert fills[3]["fill_number"] == 7483
Пример #3
0
def test_get_fill_split_filling_scheme_none_type():
    fill_number = 6000
    fills = oms.get_fills(fill_number, fill_number, split_filling_scheme=True)
    fill = fills[0]
    assert len(fills) == 1
    assert "injection_scheme" in fill
    assert "injection_scheme_spacing" in fill
Пример #4
0
def test_get_fill_split_filling_scheme_3():
    fill_number = 6082
    fills = oms.get_fills(fill_number, fill_number, split_filling_scheme=True)
    fill = fills[0]
    assert len(fills) == 1
    assert "injection_scheme" in fill
    assert fill["injection_scheme_spacing"] == None
    assert fill["injection_scheme_bunches"] == "25ns"
Пример #5
0
def test_get_fills_split_filling_scheme():
    fills = oms.get_fills(7480, 7483, split_filling_scheme=True)
    assert len(fills) == 4
    assert fills[0]["fill_number"] == 7480
    assert fills[1]["fill_number"] == 7481
    assert fills[2]["fill_number"] == 7482
    assert fills[3]["fill_number"] == 7483

    fill = fills[0]

    assert "injection_scheme" in fill
    assert "injection_scheme_spacing" in fill

    assert fill["injection_scheme"] == '75_150ns_733Pb_733_702_468_42bpi_20inj'
    assert fill["injection_scheme_spacing"] == '75'
Пример #6
0
def retrieve_fill(fill_number):
    response = oms.get_fills(fill_number, fill_number)[0]

    exclude = [
        "dump_ready_to_dump_time", "end_stable_beam", "end_time",
        "stable_beams", "start_stable_beam", "start_time",
        "to_dump_ready_time", "to_ready_time"
    ]

    fill_kwargs = {
        key: value
        for key, value in response.items() if key not in exclude
    }

    try:
        with transaction.atomic():
            OmsFill.objects.create(**fill_kwargs)
    except IntegrityError:
        OmsFill.objects.filter(fill_number=fill_number).update(**fill_kwargs)

    return OmsFill.objects.get(fill_number=fill_number)
Пример #7
0
def test_get_fills_big_range():
    fills = oms.get_fills(7000, 7495)
    assert len(fills) == 496
Пример #8
0
def test_get_fills_2():
    fills = oms.get_fills(6477, 6477)
    assert len(fills) == 1