Replace depricated dtype aliases

For numpy>=1.20
This commit is contained in:
usov_i 2023-07-02 22:32:43 +02:00
parent 015eb095a4
commit e318055304
2 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ def normalize_dataset(dataset, monitor=100_000):
def merge_duplicates(dataset): def merge_duplicates(dataset):
merged = np.zeros(len(dataset), dtype=np.bool) merged = np.zeros(len(dataset), dtype=bool)
for ind_into, scan_into in enumerate(dataset): for ind_into, scan_into in enumerate(dataset):
for ind_from, scan_from in enumerate(dataset[ind_into + 1 :], start=ind_into + 1): for ind_from, scan_from in enumerate(dataset[ind_into + 1 :], start=ind_into + 1):
if _parameters_match(scan_into, scan_from) and not merged[ind_from]: if _parameters_match(scan_into, scan_from) and not merged[ind_from]:
@ -82,7 +82,7 @@ def merge_datasets(dataset_into, dataset_from):
print(f"Scan motors mismatch between datasets: {scan_motors_into} vs {scan_motors_from}") print(f"Scan motors mismatch between datasets: {scan_motors_into} vs {scan_motors_from}")
return return
merged = np.zeros(len(dataset_from), dtype=np.bool) merged = np.zeros(len(dataset_from), dtype=bool)
for scan_into in dataset_into: for scan_into in dataset_into:
for ind, scan_from in enumerate(dataset_from): for ind, scan_from in enumerate(dataset_from):
if _parameters_match(scan_into, scan_from) and not merged[ind]: if _parameters_match(scan_into, scan_from) and not merged[ind]:

View File

@ -47,9 +47,9 @@ def parse_h5meta(file):
if variable in META_STR: if variable in META_STR:
pass pass
elif variable in META_CELL: elif variable in META_CELL:
value = np.array(value.split(",")[:6], dtype=np.float) value = np.array(value.split(",")[:6], dtype=float)
elif variable in META_MATRIX: elif variable in META_MATRIX:
value = np.array(value.split(",")[:9], dtype=np.float).reshape(3, 3) value = np.array(value.split(",")[:9], dtype=float).reshape(3, 3)
else: # default is a single float number else: # default is a single float number
value = float(value) value = float(value)
content[section][variable] = value content[section][variable] = value
@ -69,7 +69,7 @@ def read_detector_data(filepath, cami_meta=None):
ndarray: A 3D array of data, omega, gamma, nu. ndarray: A 3D array of data, omega, gamma, nu.
""" """
with h5py.File(filepath, "r") as h5f: with h5py.File(filepath, "r") as h5f:
counts = h5f["/entry1/area_detector2/data"][:].astype(np.float64) counts = h5f["/entry1/area_detector2/data"][:].astype(float)
n, cols, rows = counts.shape n, cols, rows = counts.shape
if "/entry1/experiment_identifier" in h5f: # old format if "/entry1/experiment_identifier" in h5f: # old format