diff --git a/.flake8 b/.flake8 index 60b358db..ea09a7e8 100644 --- a/.flake8 +++ b/.flake8 @@ -8,5 +8,5 @@ exclude = pyxrf/_version.py, docs/conf.py # There are some errors produced by 'black', therefore unavoidable -ignore = E203, W503 +ignore = E203, W503, E701, E704 max-line-length = 115 diff --git a/pyxrf/core/tests/test_quant_analysis.py b/pyxrf/core/tests/test_quant_analysis.py index ff21e797..02f7b54c 100644 --- a/pyxrf/core/tests/test_quant_analysis.py +++ b/pyxrf/core/tests/test_quant_analysis.py @@ -41,7 +41,7 @@ "name": "Test Micromatter 411640", "serial": "411640", "description": "CeF3 21.1 / Au 20.6", - "compounds": {"CeF3": 21.1, "Au": 20.6} + "compounds": {"CeF3": 21.1, "Au": 20.6}, # Missing optional 'density' field }, ] diff --git a/pyxrf/gui_module/wnd_detailed_fitting_params.py b/pyxrf/gui_module/wnd_detailed_fitting_params.py index e859985d..7c6de65e 100644 --- a/pyxrf/gui_module/wnd_detailed_fitting_params.py +++ b/pyxrf/gui_module/wnd_detailed_fitting_params.py @@ -393,8 +393,7 @@ def _validate_all(self): self.pb_cancel.setEnabled(self._data_changed and not self._auto_update) self.cb_auto_update.setChecked(Qt.Checked if self._auto_update else Qt.Unchecked) - def _load_dialog_data(self): - ... + def _load_dialog_data(self): ... def _save_dialog_data_function(self): raise NotImplementedError() diff --git a/pyxrf/model/catalog_management.py b/pyxrf/model/catalog_management.py index 312ccb0a..c6f96797 100644 --- a/pyxrf/model/catalog_management.py +++ b/pyxrf/model/catalog_management.py @@ -16,10 +16,11 @@ def set_name(self, name): def get_catalog(catalog_name): from packaging import version import databroker + db_version_major = version.parse(databroker.__version__).major == 1 if db_version_major == 1: raise ValueError("Non-tiled version of Databroker is installed") - + from tiled.client import from_uri c = from_uri("https://tiled.nsls2.bnl.gov") diff --git a/pyxrf/model/load_data_from_db.py b/pyxrf/model/load_data_from_db.py index 5cd91962..8cd982df 100644 --- a/pyxrf/model/load_data_from_db.py +++ b/pyxrf/model/load_data_from_db.py @@ -2804,7 +2804,10 @@ def _get_row_len(row_data): filler = Filler(db.reg.handler_reg, inplace=True) docs_primary = hdr.documents("primary", fill=False) - m, n_pt_max, missing_rows = 0, -1, [] # m - index + # Assume that the number of positions reflect the size of the row + n_pt_max = pos_data.shape[2] + + m, missing_rows = 0, [] # m - index try: while True: try: @@ -2823,10 +2826,6 @@ def _get_row_len(row_data): if is_filled: data = doc["data"][detector_field] data_det1 = np.array(data[:, 0, :], dtype=np.float32) - - # The following is the fix for the case when data has corrupt row (smaller number of data points). - # It will not work if the first row is corrupt. - n_pt_max = max(data_det1.shape[0], n_pt_max) data_det1_adjusted = np.zeros([n_pt_max, data_det1.shape[1]]) data_det1_adjusted[: data_det1.shape[0], :] = data_det1