30 lines
1.1 KiB
Python
Executable File
30 lines
1.1 KiB
Python
Executable File
import pytest
|
|
import numpy as np
|
|
from matplotlib import pyplot as plt
|
|
import unittest.mock
|
|
|
|
from sfdata import SFDataFiles
|
|
|
|
from cristallina.plot import plot_image_channel
|
|
|
|
__author__ = "Alexander Steppke"
|
|
|
|
# copied files to local git for testing:
|
|
# Auto-located gain file: /sf/jungfrau/config/gainMaps/JF16T03V01/gains.h5
|
|
# Auto-located pedestal file: /sf/cristallina/data/p20841/raw/JF_pedestals/20230221_103010.JF16T03V01.res.h5
|
|
|
|
@unittest.mock.patch("jungfrau_utils.file_adapter.locate_gain_file", lambda path, **kwargs: "tests/data/gains.h5")
|
|
@unittest.mock.patch("jungfrau_utils.file_adapter.locate_pedestal_file", lambda path, **kwargs: "tests/data/JF16T03V01.res.h5")
|
|
def test_plot_image():
|
|
fig, ax = plt.subplots()
|
|
|
|
with SFDataFiles(f"tests/data/p20841/raw/run0205/data/acq*.h5") as data:
|
|
subset = data["JF16T03V01", ]
|
|
JF = subset["JF16T03V01", ]
|
|
|
|
fig, ax = plt.subplots()
|
|
|
|
plot_image_channel(subset,"JF16T03V01", ax=ax)
|
|
|
|
im = ax.get_images()[0]
|
|
assert np.isclose(np.sum(im.get_array()), 71426.29) |