Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
b41ab102b1 | |||
bc791b1028 | |||
3ab4420912 | |||
90552cee2c | |||
6164be16f0 | |||
07f03a2a04 | |||
f89267b5ec | |||
8e6cef32b5 | |||
e318055304 | |||
015eb095a4 | |||
d145f9107d | |||
d1a0ba6fec | |||
2e2677d856 | |||
a165167902 | |||
0b88ab0c7f | |||
59d392c9ec |
3
.github/workflows/deployment.yaml
vendored
3
.github/workflows/deployment.yaml
vendored
@ -14,8 +14,9 @@ jobs:
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
$CONDA/bin/conda install --quiet --yes conda-build anaconda-client
|
||||
$CONDA/bin/conda install --quiet --yes conda-build anaconda-client conda-libmamba-solver
|
||||
$CONDA/bin/conda config --append channels conda-forge
|
||||
$CONDA/bin/conda config --set solver libmamba
|
||||
$CONDA/bin/conda config --set anaconda_upload yes
|
||||
|
||||
- name: Build and upload
|
||||
|
24
.gitlab-ci.yml
Normal file
24
.gitlab-ci.yml
Normal file
@ -0,0 +1,24 @@
|
||||
stages:
|
||||
- deploy-test
|
||||
- deploy-prod
|
||||
|
||||
deploy-test:
|
||||
stage: deploy-test
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
script:
|
||||
- cd /opt/pyzebra
|
||||
- git pull origin master --tags
|
||||
- sudo systemctl restart pyzebra-test.service
|
||||
|
||||
deploy-prod:
|
||||
stage: deploy-prod
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: delayed
|
||||
start_in: 10 minutes
|
||||
script:
|
||||
- source /opt/miniconda3/etc/profile.d/conda.sh
|
||||
- conda activate prod
|
||||
- conda update pyzebra -y
|
||||
- sudo systemctl restart pyzebra.service
|
@ -15,10 +15,10 @@ build:
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python >=3.7
|
||||
- python >=3.8
|
||||
- setuptools
|
||||
run:
|
||||
- python >=3.7
|
||||
- python >=3.8
|
||||
- numpy
|
||||
- scipy
|
||||
- h5py
|
||||
|
@ -6,4 +6,4 @@ from pyzebra.sxtal_refgen import *
|
||||
from pyzebra.utils import *
|
||||
from pyzebra.xtal import *
|
||||
|
||||
__version__ = "0.7.3"
|
||||
__version__ = "0.7.7"
|
||||
|
@ -243,8 +243,8 @@ def create():
|
||||
plot = figure(
|
||||
x_axis_label="Scan motor",
|
||||
y_axis_label="Counts",
|
||||
plot_height=470,
|
||||
plot_width=700,
|
||||
height=470,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
|
@ -112,8 +112,8 @@ def create():
|
||||
plot = figure(
|
||||
x_axis_label="Scan motor",
|
||||
y_axis_label="Counts",
|
||||
plot_height=470,
|
||||
plot_width=700,
|
||||
height=470,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
|
@ -604,7 +604,7 @@ def create():
|
||||
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
||||
plot_file.on_click(plot_file_callback)
|
||||
|
||||
plot = figure(plot_height=550, plot_width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||
plot = figure(height=550, width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||
plot.toolbar.logo = None
|
||||
|
||||
plot.xaxis.visible = False
|
||||
|
@ -275,7 +275,7 @@ def create():
|
||||
frame_range.bounds = (0, n_im)
|
||||
|
||||
scan_motor = scan["scan_motor"]
|
||||
proj_y_plot.axis[1].axis_label = f"Scanning motor, {scan_motor}"
|
||||
proj_y_plot.yaxis.axis_label = f"Scanning motor, {scan_motor}"
|
||||
|
||||
var = scan[scan_motor]
|
||||
var_start = var[0]
|
||||
@ -301,8 +301,8 @@ def create():
|
||||
x_range=det_x_range,
|
||||
y_range=frame_range,
|
||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||
plot_height=540,
|
||||
plot_width=IMAGE_PLOT_W - 3,
|
||||
height=540,
|
||||
width=IMAGE_PLOT_W - 3,
|
||||
tools="pan,box_zoom,wheel_zoom,reset",
|
||||
active_scroll="wheel_zoom",
|
||||
)
|
||||
@ -325,8 +325,8 @@ def create():
|
||||
x_range=det_y_range,
|
||||
y_range=frame_range,
|
||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||
plot_height=540,
|
||||
plot_width=IMAGE_PLOT_H + 22,
|
||||
height=540,
|
||||
width=IMAGE_PLOT_H + 22,
|
||||
tools="pan,box_zoom,wheel_zoom,reset",
|
||||
active_scroll="wheel_zoom",
|
||||
)
|
||||
@ -352,8 +352,8 @@ def create():
|
||||
colormap_select.on_change("value", colormap_select_callback)
|
||||
colormap_select.value = "Plasma256"
|
||||
|
||||
def proj_auto_checkbox_callback(state):
|
||||
if state:
|
||||
def proj_auto_checkbox_callback(_attr, _old, new):
|
||||
if 0 in new:
|
||||
proj_display_min_spinner.disabled = True
|
||||
proj_display_max_spinner.disabled = True
|
||||
else:
|
||||
@ -365,7 +365,7 @@ def create():
|
||||
proj_auto_checkbox = CheckboxGroup(
|
||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||
)
|
||||
proj_auto_checkbox.on_click(proj_auto_checkbox_callback)
|
||||
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||
|
||||
def proj_display_max_spinner_callback(_attr, _old, new):
|
||||
color_mapper_proj.high = new
|
||||
@ -411,8 +411,8 @@ def create():
|
||||
param_plot = figure(
|
||||
x_axis_label="Parameter",
|
||||
y_axis_label="Fit parameter",
|
||||
plot_height=400,
|
||||
plot_width=700,
|
||||
height=400,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
|
@ -356,8 +356,8 @@ def create():
|
||||
gamma_c = gamma[det_c_y, det_c_x]
|
||||
nu_c = nu[det_c_y, det_c_x]
|
||||
omega_c = omega[det_c_y, det_c_x]
|
||||
chi_c = None
|
||||
phi_c = None
|
||||
chi_c = scan["chi"][index]
|
||||
phi_c = scan["phi"][index]
|
||||
|
||||
else: # zebra_mode == "bi"
|
||||
wave = scan["wave"]
|
||||
@ -406,7 +406,7 @@ def create():
|
||||
frame_range.bounds = (0, n_im)
|
||||
|
||||
scan_motor = scan["scan_motor"]
|
||||
proj_y_plot.axis[1].axis_label = f"Scanning motor, {scan_motor}"
|
||||
proj_y_plot.yaxis.axis_label = f"Scanning motor, {scan_motor}"
|
||||
|
||||
var = scan[scan_motor]
|
||||
var_start = var[0]
|
||||
@ -458,8 +458,8 @@ def create():
|
||||
y_range=Range1d(0, IMAGE_H, bounds=(0, IMAGE_H)),
|
||||
x_axis_location="above",
|
||||
y_axis_location="right",
|
||||
plot_height=IMAGE_PLOT_H,
|
||||
plot_width=IMAGE_PLOT_W,
|
||||
height=IMAGE_PLOT_H,
|
||||
width=IMAGE_PLOT_W,
|
||||
toolbar_location="left",
|
||||
tools="pan,box_zoom,wheel_zoom,reset",
|
||||
active_scroll="wheel_zoom",
|
||||
@ -509,8 +509,8 @@ def create():
|
||||
proj_v = figure(
|
||||
x_range=plot.x_range,
|
||||
y_axis_location="right",
|
||||
plot_height=150,
|
||||
plot_width=IMAGE_PLOT_W,
|
||||
height=150,
|
||||
width=IMAGE_PLOT_W,
|
||||
tools="",
|
||||
toolbar_location=None,
|
||||
)
|
||||
@ -524,8 +524,8 @@ def create():
|
||||
proj_h = figure(
|
||||
x_axis_location="above",
|
||||
y_range=plot.y_range,
|
||||
plot_height=IMAGE_PLOT_H,
|
||||
plot_width=150,
|
||||
height=IMAGE_PLOT_H,
|
||||
width=150,
|
||||
tools="",
|
||||
toolbar_location=None,
|
||||
)
|
||||
@ -589,8 +589,8 @@ def create():
|
||||
y_range=frame_range,
|
||||
extra_x_ranges={"gamma": gamma_range},
|
||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||
plot_height=540,
|
||||
plot_width=IMAGE_PLOT_W - 3,
|
||||
height=540,
|
||||
width=IMAGE_PLOT_W - 3,
|
||||
tools="pan,box_zoom,wheel_zoom,reset",
|
||||
active_scroll="wheel_zoom",
|
||||
)
|
||||
@ -617,8 +617,8 @@ def create():
|
||||
y_range=frame_range,
|
||||
extra_x_ranges={"nu": nu_range},
|
||||
extra_y_ranges={"scanning_motor": scanning_motor_range},
|
||||
plot_height=540,
|
||||
plot_width=IMAGE_PLOT_H + 22,
|
||||
height=540,
|
||||
width=IMAGE_PLOT_H + 22,
|
||||
tools="pan,box_zoom,wheel_zoom,reset",
|
||||
active_scroll="wheel_zoom",
|
||||
)
|
||||
@ -636,7 +636,7 @@ def create():
|
||||
proj_y_image = proj_y_plot.image(source=proj_y_image_source, color_mapper=lin_color_mapper_proj)
|
||||
|
||||
# ROI slice plot
|
||||
roi_avg_plot = figure(plot_height=150, plot_width=IMAGE_PLOT_W, tools="", toolbar_location=None)
|
||||
roi_avg_plot = figure(height=150, width=IMAGE_PLOT_W, tools="", toolbar_location=None)
|
||||
|
||||
roi_avg_plot_line_source = ColumnDataSource(dict(x=[], y=[]))
|
||||
roi_avg_plot.line(source=roi_avg_plot_line_source, line_color="steelblue")
|
||||
@ -655,8 +655,8 @@ def create():
|
||||
colormap_select.on_change("value", colormap_select_callback)
|
||||
colormap_select.value = "Plasma256"
|
||||
|
||||
def colormap_scale_rg_callback(selection):
|
||||
if selection == 0: # Linear
|
||||
def colormap_scale_rg_callback(_attr, _old, new):
|
||||
if new == 0: # Linear
|
||||
plot_image.glyph.color_mapper = lin_color_mapper
|
||||
proj_x_image.glyph.color_mapper = lin_color_mapper_proj
|
||||
proj_y_image.glyph.color_mapper = lin_color_mapper_proj
|
||||
@ -675,10 +675,10 @@ def create():
|
||||
colormap_scale_rg.active = 0
|
||||
|
||||
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
||||
colormap_scale_rg.on_click(colormap_scale_rg_callback)
|
||||
colormap_scale_rg.on_change("active", colormap_scale_rg_callback)
|
||||
|
||||
def main_auto_checkbox_callback(state):
|
||||
if state:
|
||||
def main_auto_checkbox_callback(_attr, _old, new):
|
||||
if 0 in new:
|
||||
display_min_spinner.disabled = True
|
||||
display_max_spinner.disabled = True
|
||||
else:
|
||||
@ -690,7 +690,7 @@ def create():
|
||||
main_auto_checkbox = CheckboxGroup(
|
||||
labels=["Frame Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||
)
|
||||
main_auto_checkbox.on_click(main_auto_checkbox_callback)
|
||||
main_auto_checkbox.on_change("active", main_auto_checkbox_callback)
|
||||
|
||||
def display_max_spinner_callback(_attr, _old, new):
|
||||
lin_color_mapper.high = new
|
||||
@ -709,8 +709,8 @@ def create():
|
||||
display_min_spinner = Spinner(value=0, disabled=bool(main_auto_checkbox.active), width=100)
|
||||
display_min_spinner.on_change("value", display_min_spinner_callback)
|
||||
|
||||
def proj_auto_checkbox_callback(state):
|
||||
if state:
|
||||
def proj_auto_checkbox_callback(_attr, _old, new):
|
||||
if 0 in new:
|
||||
proj_display_min_spinner.disabled = True
|
||||
proj_display_max_spinner.disabled = True
|
||||
else:
|
||||
@ -722,7 +722,7 @@ def create():
|
||||
proj_auto_checkbox = CheckboxGroup(
|
||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||
)
|
||||
proj_auto_checkbox.on_click(proj_auto_checkbox_callback)
|
||||
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||
|
||||
def proj_display_max_spinner_callback(_attr, _old, new):
|
||||
lin_color_mapper_proj.high = new
|
||||
@ -811,7 +811,7 @@ def create():
|
||||
|
||||
gamma = scan["gamma"][0]
|
||||
omega = scan["omega"][0]
|
||||
nu = scan["nu"][0]
|
||||
nu = scan["nu"]
|
||||
chi = scan["chi"][0]
|
||||
phi = scan["phi"][0]
|
||||
|
||||
@ -842,10 +842,6 @@ def create():
|
||||
x_pos = scan["fit"]["x_pos"]
|
||||
y_pos = scan["fit"]["y_pos"]
|
||||
|
||||
if scan["zebra_mode"] == "nb":
|
||||
chi = None
|
||||
phi = None
|
||||
|
||||
events_data["wave"].append(wave)
|
||||
events_data["ddist"].append(ddist)
|
||||
events_data["cell"].append(cell)
|
||||
|
@ -209,8 +209,8 @@ def create():
|
||||
plot = figure(
|
||||
x_axis_label="Scan motor",
|
||||
y_axis_label="Counts",
|
||||
plot_height=450,
|
||||
plot_width=700,
|
||||
height=450,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
@ -243,8 +243,8 @@ def create():
|
||||
ov_plot = figure(
|
||||
x_axis_label="Scan motor",
|
||||
y_axis_label="Counts",
|
||||
plot_height=450,
|
||||
plot_width=700,
|
||||
height=450,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
@ -261,8 +261,8 @@ def create():
|
||||
y_axis_label="Param",
|
||||
x_range=Range1d(),
|
||||
y_range=Range1d(),
|
||||
plot_height=450,
|
||||
plot_width=700,
|
||||
height=450,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
@ -279,8 +279,8 @@ def create():
|
||||
param_plot = figure(
|
||||
x_axis_label="Parameter",
|
||||
y_axis_label="Fit parameter",
|
||||
plot_height=400,
|
||||
plot_width=700,
|
||||
height=400,
|
||||
width=700,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
|
||||
|
@ -290,8 +290,8 @@ def create():
|
||||
plot = figure(
|
||||
x_range=DataRange1d(),
|
||||
y_range=DataRange1d(),
|
||||
plot_height=550 + 27,
|
||||
plot_width=550 + 117,
|
||||
height=550 + 27,
|
||||
width=550 + 117,
|
||||
tools="pan,wheel_zoom,reset",
|
||||
)
|
||||
plot.toolbar.logo = None
|
||||
@ -324,7 +324,7 @@ def create():
|
||||
hkl_in_plane_y = TextInput(title="in-plane Y", value="", width=100, disabled=True)
|
||||
|
||||
def redef_lattice_cb_callback(_attr, _old, new):
|
||||
if new:
|
||||
if 0 in new:
|
||||
redef_lattice_ti.disabled = False
|
||||
else:
|
||||
redef_lattice_ti.disabled = True
|
||||
@ -334,7 +334,7 @@ def create():
|
||||
redef_lattice_ti = TextInput(width=490, disabled=True)
|
||||
|
||||
def redef_ub_cb_callback(_attr, _old, new):
|
||||
if new:
|
||||
if 0 in new:
|
||||
redef_ub_ti.disabled = False
|
||||
else:
|
||||
redef_ub_ti.disabled = True
|
||||
@ -369,8 +369,8 @@ def create():
|
||||
display_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
||||
display_max_ni.on_change("value", display_max_ni_callback)
|
||||
|
||||
def colormap_scale_rg_callback(selection):
|
||||
if selection == 0: # Linear
|
||||
def colormap_scale_rg_callback(_attr, _old, new):
|
||||
if new == 0: # Linear
|
||||
plot_image.glyph.color_mapper = lin_color_mapper
|
||||
lin_color_bar.visible = True
|
||||
log_color_bar.visible = False
|
||||
@ -384,7 +384,7 @@ def create():
|
||||
colormap_scale_rg.active = 0
|
||||
|
||||
colormap_scale_rg = RadioGroup(labels=["Linear", "Logarithmic"], active=0, width=100)
|
||||
colormap_scale_rg.on_click(colormap_scale_rg_callback)
|
||||
colormap_scale_rg.on_change("active", colormap_scale_rg_callback)
|
||||
|
||||
xrange_min_ni = NumericInput(title="x range min:", value=0, mode="float", width=70)
|
||||
xrange_max_ni = NumericInput(title="max:", value=1, mode="float", width=70)
|
||||
@ -395,7 +395,7 @@ def create():
|
||||
yrange_step_ni = NumericInput(title="y mesh:", value=0.01, mode="float", width=70)
|
||||
|
||||
def auto_range_cb_callback(_attr, _old, new):
|
||||
if new:
|
||||
if 0 in new:
|
||||
xrange_min_ni.disabled = True
|
||||
xrange_max_ni.disabled = True
|
||||
yrange_min_ni.disabled = True
|
||||
|
@ -441,7 +441,7 @@ class PlotHKL:
|
||||
plot_file = Button(label="Plot selected file(s)", button_type="primary", width=200)
|
||||
plot_file.on_click(plot_file_callback)
|
||||
|
||||
plot = figure(plot_height=550, plot_width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||
plot = figure(height=550, width=550 + 32, tools="pan,wheel_zoom,reset")
|
||||
plot.toolbar.logo = None
|
||||
|
||||
plot.xaxis.visible = False
|
||||
@ -517,7 +517,7 @@ class PlotHKL:
|
||||
tol_k_ni = NumericInput(title="k tolerance:", value=0.01, mode="float", width=100)
|
||||
|
||||
def show_legend_cb_callback(_attr, _old, new):
|
||||
plot.legend.visible = bool(new)
|
||||
plot.legend.visible = 0 in new
|
||||
|
||||
show_legend_cb = CheckboxGroup(labels=["Show legend"], active=[0])
|
||||
show_legend_cb.on_change("active", show_legend_cb_callback)
|
||||
|
@ -8,41 +8,45 @@ import numpy as np
|
||||
META_VARS_STR = (
|
||||
"instrument",
|
||||
"title",
|
||||
"sample",
|
||||
"comment",
|
||||
"user",
|
||||
"ProposalID",
|
||||
"proposal_id",
|
||||
"original_filename",
|
||||
"date",
|
||||
"zebra_mode",
|
||||
"proposal",
|
||||
"proposal_user",
|
||||
"proposal_title",
|
||||
"proposal_email",
|
||||
"detectorDistance",
|
||||
"sample_name",
|
||||
)
|
||||
|
||||
META_VARS_FLOAT = (
|
||||
"omega",
|
||||
"mf",
|
||||
"2-theta",
|
||||
"chi",
|
||||
"phi",
|
||||
"nu",
|
||||
"temp",
|
||||
"wavelength",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"alpha",
|
||||
"beta",
|
||||
"gamma",
|
||||
"omega",
|
||||
"chi",
|
||||
"phi",
|
||||
"temp",
|
||||
"mf",
|
||||
"temperature",
|
||||
"magnetic_field",
|
||||
"cex1",
|
||||
"cex2",
|
||||
"wavelength",
|
||||
"mexz",
|
||||
"moml",
|
||||
"mcvl",
|
||||
"momu",
|
||||
"mcvu",
|
||||
"2-theta",
|
||||
"twotheta",
|
||||
"nu",
|
||||
"gamma_angle",
|
||||
"polar_angle",
|
||||
"tilt_angle",
|
||||
"distance",
|
||||
"distance_an",
|
||||
"snv",
|
||||
"snh",
|
||||
"snvm",
|
||||
@ -55,6 +59,13 @@ META_VARS_FLOAT = (
|
||||
"s2vb",
|
||||
"s2hr",
|
||||
"s2hl",
|
||||
"a5",
|
||||
"a6",
|
||||
"a4t",
|
||||
"s2ant",
|
||||
"s2anb",
|
||||
"s2anl",
|
||||
"s2anr",
|
||||
)
|
||||
|
||||
META_UB_MATRIX = ("ub1j", "ub2j", "ub3j", "UB")
|
||||
@ -116,6 +127,10 @@ def parse_1D(fileobj, data_type):
|
||||
var_name = var_name.strip()
|
||||
value = value.strip()
|
||||
|
||||
if value == "UNKNOWN":
|
||||
metadata[var_name] = None
|
||||
continue
|
||||
|
||||
try:
|
||||
if var_name in META_VARS_STR:
|
||||
metadata[var_name] = value
|
||||
@ -123,6 +138,10 @@ def parse_1D(fileobj, data_type):
|
||||
elif var_name in META_VARS_FLOAT:
|
||||
if var_name == "2-theta": # fix that angle name not to be an expression
|
||||
var_name = "twotheta"
|
||||
if var_name == "temperature":
|
||||
var_name = "temp"
|
||||
if var_name == "magnetic_field":
|
||||
var_name = "mf"
|
||||
if var_name in ("a", "b", "c", "alpha", "beta", "gamma"):
|
||||
var_name += "_cell"
|
||||
metadata[var_name] = float(value)
|
||||
@ -202,9 +221,12 @@ def parse_1D(fileobj, data_type):
|
||||
dataset.append({**metadata, **scan})
|
||||
|
||||
elif data_type == ".dat":
|
||||
# TODO: this might need to be adapted in the future, when "gamma" will be added to dat files
|
||||
if metadata["zebra_mode"] == "nb":
|
||||
metadata["gamma"] = metadata["twotheta"]
|
||||
if "gamma_angle" in metadata:
|
||||
# support for the new format
|
||||
metadata["gamma"] = metadata["gamma_angle"]
|
||||
else:
|
||||
metadata["gamma"] = metadata["twotheta"]
|
||||
|
||||
scan = defaultdict(list)
|
||||
scan["export"] = True
|
||||
|
@ -34,7 +34,7 @@ def normalize_dataset(dataset, monitor=100_000):
|
||||
|
||||
|
||||
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_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]:
|
||||
@ -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}")
|
||||
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 ind, scan_from in enumerate(dataset_from):
|
||||
if _parameters_match(scan_into, scan_from) and not merged[ind]:
|
||||
|
@ -47,9 +47,9 @@ def parse_h5meta(file):
|
||||
if variable in META_STR:
|
||||
pass
|
||||
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:
|
||||
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
|
||||
value = float(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.
|
||||
"""
|
||||
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
|
||||
if "/entry1/experiment_identifier" in h5f: # old format
|
||||
@ -114,10 +114,14 @@ def read_detector_data(filepath, cami_meta=None):
|
||||
scan["nu"] = h5f["/entry1/ZEBRA/area_detector2/tilt_angle"][0]
|
||||
scan["ddist"] = h5f["/entry1/ZEBRA/area_detector2/distance"][0]
|
||||
scan["wave"] = h5f["/entry1/ZEBRA/monochromator/wavelength"][0]
|
||||
scan["chi"] = h5f["/entry1/sample/chi"][:]
|
||||
if scan["zebra_mode"] == "nb":
|
||||
scan["chi"] = np.array([180])
|
||||
scan["phi"] = np.array([0])
|
||||
elif scan["zebra_mode"] == "bi":
|
||||
scan["chi"] = h5f["/entry1/sample/chi"][:]
|
||||
scan["phi"] = h5f["/entry1/sample/phi"][:]
|
||||
if len(scan["chi"]) == 1:
|
||||
scan["chi"] = np.ones(n) * scan["chi"]
|
||||
scan["phi"] = h5f["/entry1/sample/phi"][:]
|
||||
if len(scan["phi"]) == 1:
|
||||
scan["phi"] = np.ones(n) * scan["phi"]
|
||||
if h5f["/entry1/sample/UB"].size == 0:
|
||||
|
Reference in New Issue
Block a user