diff --git a/tests/test_agipdlib.py b/tests/test_agipdlib.py index 7616171b341f449b4cfc1ecac2e6f12b5e42ea1e..973e90f9bcb46f724a6e2838117af311662bbdde 100644 --- a/tests/test_agipdlib.py +++ b/tests/test_agipdlib.py @@ -8,7 +8,7 @@ SPB_AGIPD_INST_SRC = 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' CTRL_SRC = 'SPB_IRU_AGIPD1M1/MDL/FPGA_COMP' -def test_get_acq_rate_run(mock_agipd1m_run): +def test_get_acq_rate_ctrl(mock_agipd1m_run): # Current up to date data with acq_rate stored # as repetition rate in slow data. agipd_ctrl = AgipdCtrl( @@ -16,20 +16,7 @@ def test_get_acq_rate_run(mock_agipd1m_run): image_src=SPB_AGIPD_INST_SRC, ctrl_src=CTRL_SRC) - acq_rate = agipd_ctrl.get_acq_rate() - assert isinstance(acq_rate, float) - assert acq_rate == 4.5 - - -def test_get_acq_rate_fast(mock_agipd1m_run): - # Current up to date data with acq_rate stored - # as repetition rate in slow data. - agipd_ctrl = AgipdCtrl( - run_dc=RunDirectory(mock_agipd1m_run), - image_src=SPB_AGIPD_INST_SRC, - ctrl_src=CTRL_SRC) - - acq_rate = agipd_ctrl._get_acq_rate_run() + acq_rate = agipd_ctrl._get_acq_rate_ctrl() assert isinstance(acq_rate, float) assert acq_rate == 4.5 @@ -42,7 +29,7 @@ def test_get_acq_rate_instr(mock_agipd1m_run_old): run_dc=RunDirectory(mock_agipd1m_run_old), image_src=SPB_AGIPD_INST_SRC, ctrl_src=None) - acq_rate = agipd_ctrl.get_acq_rate() + acq_rate = agipd_ctrl._get_acq_rate_instr() assert isinstance(acq_rate, float) assert acq_rate == 4.5 @@ -56,7 +43,7 @@ def test_get_acq_rate(mock_agipd1m_run, mock_agipd1m_run_old): image_src=SPB_AGIPD_INST_SRC, ctrl_src=CTRL_SRC) - acq_rate = agipd_ctrl._get_acq_rate_instr() + acq_rate = agipd_ctrl.get_acq_rate() assert isinstance(acq_rate, float) assert acq_rate == 4.5 @@ -83,25 +70,25 @@ def test_get_num_cells(mock_agipd1m_run): assert mem_cells == 64 -def test_get_gain_setting_run(mock_agipd1m_run): +def test_get_gain_setting_ctrl(mock_agipd1m_run): # Reading gain setting from slow data. agipd_ctrl = AgipdCtrl( run_dc=RunDirectory(mock_agipd1m_run), image_src=SPB_AGIPD_INST_SRC, ctrl_src=CTRL_SRC) - gain_setting = agipd_ctrl._get_gain_setting_run() + gain_setting = agipd_ctrl._get_gain_setting_ctrl() assert isinstance(gain_setting, int) assert gain_setting == 0 -def test_get_gain_setting_run_old(mock_agipd1m_run_old): +def test_get_gain_setting_ctrl_old(mock_agipd1m_run_old): # Reading gain setting from setupr and ..... agipd_ctrl = AgipdCtrl( run_dc=RunDirectory(mock_agipd1m_run_old), image_src=SPB_AGIPD_INST_SRC, ctrl_src=CTRL_SRC) - gain_setting = agipd_ctrl._get_gain_setting_run_old() + gain_setting = agipd_ctrl._get_gain_setting_ctrl_old() assert isinstance(gain_setting, int) assert gain_setting == 0 @@ -117,7 +104,7 @@ def test_get_gain_setting(mock_agipd1m_run, mock_agipd1m_run_old): assert isinstance(gain_setting, int) assert gain_setting == 0 - # Reading gain setting from setupr and ..... + # Reading gain setting from setupr and patternTypeIndex agipd_ctrl = AgipdCtrl( run_dc=RunDirectory(mock_agipd1m_run_old), image_src=SPB_AGIPD_INST_SRC, @@ -132,6 +119,7 @@ def test_get_gain_setting(mock_agipd1m_run, mock_agipd1m_run_old): image_src=SPB_AGIPD_INST_SRC, ctrl_src=CTRL_SRC) + # Pass old creation_date before introducing gain_setting in 2020. gain_setting = agipd_ctrl.get_gain_setting( creation_time=datetime.strptime( "2019-12-16T08:52:25", @@ -167,8 +155,8 @@ def test_get_bias_voltage( assert isinstance(bias_voltage, int) assert bias_voltage == 300 - # Read bias voltage for SPB_DET_AGIPD1M-1 and MID_DET_AGIPD1M-1 - # from slow data. + # Fail to read bias voltage for SPB_DET_AGIPD1M-1 and MID_DET_AGIPD1M-1 + # from old data and return default value. agipd_ctrl = AgipdCtrl( run_dc=RunDirectory(mock_agipd1m_run_old), image_src=SPB_AGIPD_INST_SRC,