def test_lstchain_merge_dl1_hdf5_observed_files(temp_dir_observed_files,
                                                observed_dl1_files):
    merged_dl1_observed_file = temp_dir_observed_files / "dl1_LST-1.Run02008_merged.h5"
    run_program(
        "lstchain_merge_hdf5_files",
        "-d",
        temp_dir_observed_files,
        "-o",
        merged_dl1_observed_file,
        "--no-image",
        "False",
        "--smart",
        "False",
        "--run-number",
        "2008",
        "--pattern",
        "dl1_*.h5",
    )
    dl1a_df = pd.read_hdf(observed_dl1_files["dl1_file1"],
                          key=dl1_params_lstcam_key)
    dl1b_df = pd.read_hdf(observed_dl1_files["dl1_file1"],
                          key=dl1_params_lstcam_key)
    merged_dl1_df = pd.read_hdf(merged_dl1_observed_file,
                                key=dl1_params_lstcam_key)
    assert merged_dl1_observed_file.is_file()
    assert len(dl1a_df) + len(dl1b_df) == len(merged_dl1_df)
    assert "dl1/event/telescope/image/LST_LSTCam" in get_dataset_keys(
        merged_dl1_observed_file)
    assert "dl1/event/telescope/parameters/LST_LSTCam" in get_dataset_keys(
        merged_dl1_observed_file)
示例#2
0
def test_observed_dl1_validity(observed_dl1_files):
    dl1_df = pd.read_hdf(observed_dl1_files["dl1_file1"],
                         key=dl1_params_lstcam_key)
    # The first valid timestamp in the test run corresponds
    # to its third event (see night summary)
    first_timestamp_nightsummary = 1582059789516351903  # ns
    first_event_timestamp = dl1_df["dragon_time"].iloc[2]  # third event

    dl1_tables = get_dataset_keys(observed_dl1_files["dl1_file1"])

    assert 'dl1/event/telescope/monitoring/calibration' in dl1_tables
    assert 'dl1/event/telescope/monitoring/flatfield' in dl1_tables
    assert 'dl1/event/telescope/monitoring/pedestal' in dl1_tables
    assert 'dl1/event/telescope/image/LST_LSTCam' in dl1_tables

    assert "alt_tel" in dl1_df.columns
    assert "az_tel" in dl1_df.columns
    assert "trigger_type" in dl1_df.columns
    assert "ucts_trigger_type" in dl1_df.columns
    assert "trigger_time" in dl1_df.columns
    assert "dragon_time" in dl1_df.columns
    assert "tib_time" in dl1_df.columns
    assert "ucts_time" in dl1_df.columns
    assert np.isclose(
        (Time(first_event_timestamp, format='unix') -
         Time(first_timestamp_nightsummary / 1e9, format='unix_tai')).to_value(
             u.s), 0)
    np.testing.assert_allclose(dl1_df["dragon_time"], dl1_df["trigger_time"])
示例#3
0
def test_observed_dl1_validity(observed_dl1_files):
    dl1_df = pd.read_hdf(observed_dl1_files["dl1_file1"],
                         key=dl1_params_lstcam_key)
    # The first valid timestamp in the test run corresponds
    # to its third event (see night summary)
    first_timestamp_nightsummary = 1582059789516351903  # ns
    first_event_timestamp = dl1_df["dragon_time"].iloc[2]  # third event

    dl1_tables = get_dataset_keys(observed_dl1_files["dl1_file1"])

    assert dl1_params_lstcam_key in dl1_tables
    assert dl1_images_lstcam_key in dl1_tables
    assert dl1_params_tel_mon_cal_key in dl1_tables
    assert dl1_params_tel_mon_ped_key in dl1_tables
    assert dl1_params_tel_mon_flat_key in dl1_tables

    subarray = SubarrayDescription.from_hdf(observed_dl1_files['dl1_file1'])
    assert 1 in subarray.tel
    assert subarray.tel[1].name == "LST"

    assert "alt_tel" in dl1_df.columns
    assert "az_tel" in dl1_df.columns
    assert "trigger_type" in dl1_df.columns
    assert "ucts_trigger_type" in dl1_df.columns
    assert "trigger_time" in dl1_df.columns
    assert "dragon_time" in dl1_df.columns
    assert "tib_time" in dl1_df.columns
    assert "ucts_time" in dl1_df.columns
    assert np.isclose(
        (Time(first_event_timestamp, format="unix") -
         Time(first_timestamp_nightsummary / 1e9, format="unix_tai")).to_value(
             u.s),
        0,
    )
    np.testing.assert_allclose(dl1_df["dragon_time"], dl1_df["trigger_time"])