Skip to content
Snippets Groups Projects
Commit 2be9543f authored by Mauro Rovezzi's avatar Mauro Rovezzi
Browse files

add sandbox notebook for testing

parent ee9295cc
No related branches found
No related tags found
2 merge requests!4Minor updates and bug fixes,!3Fix10 rebin second dataset
%% Cell type:markdown id: tags:
# Development sandbox notebook
This notebook is for development and testing of new features and bug fixes only.
%% Cell type:code id: tags:
``` python
%load_ext autoreload
%autoreload 2
# Uncomment the following two lines if the plots do not show in the notebook
# import plotly.io as pio
# pio.renderers.default = "iframe"
import os
from dataclasses import asdict
from IPython.display import display
from famewoks import __version__ as wkflver
from famewoks.datamodel import (
ExpSession,
ExpCounters,
CNTS_FLUO_XMAP,
CNTS_FLUO,
CNTS_CAS,
)
from famewoks.tests.datainfos import DATAINFOS, get_exp_session
from famewoks.plots import plot_data, plot_eshift
from famewoks.bliss2larch import (
search_samples,
show_samples_info,
search_datasets,
load_data,
get_scans,
get_group,
set_enealign,
apply_eshift,
set_bad_fluo_channels,
set_bad_scans,
set_bad_samples,
merge_data,
save_data,
)
from famewoks.bliss2larch import _logger
# adjust the logger level:
# "DEBUG" -> show all messages
# "INFO" -> useful messages
# "WARNING" -> warnings only
# "ERROR" -> only errors
_logger.setLevel("INFO")
# show workflow version (and famewoks branch information)
branch = os.popen("cd ~/devel/famewoks; git branch --show-current").read()[:-1]
_logger.info(f"--> Using famewoks version: {wkflver} (branch: {branch})")
# define the counters names or use those already defined for BM16: CNTS_FLUO_XMAP, CNTS_FLUO, CNTS_CAS
CNTS_CAS_XPAD = ExpCounters(
ene="energy_enc",
ix=["p201_1_bkg_sub", "p201_3_bkg_sub", "p201_5_bkg_sub"], #: I0, I1, I2
fluo_roi=["xpad_roi1"], # all detector names for ROI1
fluo_corr=["xpad_roi1"], # all detector names (DT corrected)
fluo_time=["sec"], # elapsed time, which is different for the spikes
time="sec", # "musst_timer"
)
# define the experimental session metadata manually
session = ExpSession(
flag=1,
datadir="/data/visitor/a161838/bm16/20241113",
proposal="a161838",
session="20241113",
proposer="Quantin",
lc="AA, IK",
elem="V",
edge="K",
comment="",
counters=CNTS_CAS, # *NOTE* give here the correct counters names!
samples=[],
bad_samples=[],
bad_fluo_channels=None,
enealign=None,
)
# (testing) otherwise it is possible to get the session from a collection of previous experiments
# session = get_exp_session(DATAINFOS, proposer="Isaure",session="20241003")
# session = get_exp_session(DATAINFOS, proposer="Rimondi",session="20241001")
# session = get_exp_session(DATAINFOS, proposer="Biswas",session="20240924")
# session = get_exp_session(DATAINFOS, proposer="Sanchez",session="20240716")
# session = get_exp_session(DATAINFOS, proposer="Stellato",session="20240625")
# session = get_exp_session(DATAINFOS, proposer="Bertrand",session="20240910")
# display the session metadata
#display(asdict(session))
```
%% Cell type:code id: tags:
``` python
samples = search_samples(session, ignore_names=["rack", "mount", "align", "bl_", "sample"])
```
%% Cell type:code id: tags:
``` python
sel_sample = 10
datasets = search_datasets(session, sample=sel_sample)
```
%% Cell type:code id: tags:
``` python
sel_dataset = 0
dataset = datasets[sel_dataset]
load_data(
session,
dataset,
use_fluo_corr=False,
iskip=1, #: ignore the first point
istrip=1, #: ignore the last point
calc_eshift=True,
merge=True,
skip_scans=[],
)
```
%% Cell type:code id: tags:
``` python
fig = plot_data(
dataset,
data="fluo",
ynorm="area",
show_slide=True,
show_i0=False,
show_e0=True,
show_merge="rebin",
)
```
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment