Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xafs metadata #295

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/firefly/plans/regions_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def get_scan_parameters(self):
def get_meta_data(self):
# Get meta data info
md = {
"sample": self.ui.lineEdit_sample.text(),
"sample_name": self.ui.lineEdit_sample.text(),
"purpose": self.ui.lineEdit_purpose.text(),
"notes": self.ui.textEdit_notes.toPlainText(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/plans/xafs_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def queue_plan(self, *args, **kwargs):
detectors = self.ui.detectors_list.selected_detectors()
repeat_scan_num = int(self.ui.spinBox_repeat_scan_num.value())
md = {
"sample": self.ui.lineEdit_sample.text(),
"sample_name": self.ui.lineEdit_sample.text(),
"purpose": self.ui.lineEdit_purpose.text(),
"is_standard": self.ui.checkBox_is_standard.isChecked(),
"notes": self.ui.textEdit_notes.toPlainText(),
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/tests/test_grid_scan_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def test_grid_scan_plan_queued(display, qtbot, sim_registry, ion_chamber):
111.0,
5,
snake_axes=["sync_motor_2"],
md={"sample": "sam", "purpose": "test", "notes": "notes"},
md={"sample_name": "sam", "purpose": "test", "notes": "notes"},
)

def check_item(item):
Expand Down
2 changes: 1 addition & 1 deletion src/firefly/tests/test_line_scan_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def test_line_scan_plan_queued(qtbot, display):
2.0,
222.0,
num=10,
md={"sample": "sam", "purpose": "test", "notes": "notes"},
md={"sample_name": "sam", "purpose": "test", "notes": "notes"},
)

def check_item(item):
Expand Down
4 changes: 2 additions & 2 deletions src/firefly/tests/test_xafs_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_xafs_scan_plan_queued_energies(display, qtbot):
E0=11500.8,
detectors=["vortex_me4", "I0"],
md={
"sample": "sam",
"sample_name": "sam",
"purpose": "test",
"is_standard": True,
"notes": "sam_notes",
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_xafs_scan_plan_queued_energies_k_mixed(qtbot, display):
E0=11500.8,
detectors=["vortex_me4", "I0"],
md={
"sample": "sam",
"sample_name": "sam",
"is_standard": False,
"notes": "sam_notes",
},
Expand Down
19 changes: 19 additions & 0 deletions src/haven/tests/test_energy_xafs_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,25 @@ def test_remove_duplicate_energies(mono_motor, exposure_motor, I0):
assert len(read_msgs) == len(energies)


def test_xafs_metadata(mono_motor):
scan = energy_scan(
[],
detectors=[],
energy_signals=[mono_motor],
E0="Ni_K",
md={"sample_name": "unobtanium"},
)
# Get the metadata passed alongside the "open_run" message
msgs = list(scan)
open_msg = [m for m in msgs if m.command == "open_run"][0]
md = open_msg.kwargs
# Check that the metadata has the right values
assert md["edge"] == "Ni_K"
assert md["E0"] == 8333.0
assert md["plan_name"] == "energy_scan"
assert md["sample_name"] == "unobtanium"


# -----------------------------------------------------------------------------
# :author: Mark Wolfman
# :email: [email protected]
Expand Down