Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
famewoks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
F-CRG
FAMEs
famewoks
Commits
2be9543f
Commit
2be9543f
authored
4 months ago
by
Mauro Rovezzi
Browse files
Options
Downloads
Patches
Plain Diff
add sandbox notebook for testing
parent
ee9295cc
No related branches found
No related tags found
2 merge requests
!4
Minor updates and bug fixes
,
!3
Fix10 rebin second dataset
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebooks/devel_sandbox.ipynb
+190
-0
190 additions, 0 deletions
notebooks/devel_sandbox.ipynb
with
190 additions
and
0 deletions
notebooks/devel_sandbox.ipynb
0 → 100644
+
190
−
0
View file @
2be9543f
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Development sandbox notebook\n",
"\n",
"This notebook is for development and testing of new features and bug fixes only."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"# Uncomment the following two lines if the plots do not show in the notebook\n",
"# import plotly.io as pio\n",
"# pio.renderers.default = \"iframe\"\n",
"\n",
"import os\n",
"from dataclasses import asdict\n",
"from IPython.display import display\n",
"from famewoks import __version__ as wkflver\n",
"from famewoks.datamodel import (\n",
" ExpSession,\n",
" ExpCounters,\n",
" CNTS_FLUO_XMAP,\n",
" CNTS_FLUO,\n",
" CNTS_CAS,\n",
")\n",
"from famewoks.tests.datainfos import DATAINFOS, get_exp_session\n",
"from famewoks.plots import plot_data, plot_eshift\n",
"from famewoks.bliss2larch import (\n",
" search_samples,\n",
" show_samples_info,\n",
" search_datasets,\n",
" load_data,\n",
" get_scans,\n",
" get_group,\n",
" set_enealign,\n",
" apply_eshift,\n",
" set_bad_fluo_channels,\n",
" set_bad_scans,\n",
" set_bad_samples,\n",
" merge_data,\n",
" save_data,\n",
")\n",
"from famewoks.bliss2larch import _logger\n",
"\n",
"# adjust the logger level:\n",
"# \"DEBUG\" -> show all messages\n",
"# \"INFO\" -> useful messages\n",
"# \"WARNING\" -> warnings only\n",
"# \"ERROR\" -> only errors\n",
"_logger.setLevel(\"INFO\")\n",
"\n",
"# show workflow version (and famewoks branch information)\n",
"branch = os.popen(\"cd ~/devel/famewoks; git branch --show-current\").read()[:-1]\n",
"_logger.info(f\"--> Using famewoks version: {wkflver} (branch: {branch})\")\n",
"\n",
"# define the counters names or use those already defined for BM16: CNTS_FLUO_XMAP, CNTS_FLUO, CNTS_CAS\n",
"CNTS_CAS_XPAD = ExpCounters(\n",
" ene=\"energy_enc\",\n",
" ix=[\"p201_1_bkg_sub\", \"p201_3_bkg_sub\", \"p201_5_bkg_sub\"], #: I0, I1, I2\n",
" fluo_roi=[\"xpad_roi1\"], # all detector names for ROI1\n",
" fluo_corr=[\"xpad_roi1\"], # all detector names (DT corrected)\n",
" fluo_time=[\"sec\"], # elapsed time, which is different for the spikes\n",
" time=\"sec\", # \"musst_timer\"\n",
")\n",
"# define the experimental session metadata manually\n",
"session = ExpSession(\n",
" flag=1,\n",
" datadir=\"/data/visitor/a161838/bm16/20241113\",\n",
" proposal=\"a161838\",\n",
" session=\"20241113\",\n",
" proposer=\"Quantin\",\n",
" lc=\"AA, IK\",\n",
" elem=\"V\",\n",
" edge=\"K\",\n",
" comment=\"\",\n",
" counters=CNTS_CAS, # *NOTE* give here the correct counters names!\n",
" samples=[],\n",
" bad_samples=[],\n",
" bad_fluo_channels=None,\n",
" enealign=None,\n",
")\n",
"\n",
"# (testing) otherwise it is possible to get the session from a collection of previous experiments\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Isaure\",session=\"20241003\")\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Rimondi\",session=\"20241001\")\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Biswas\",session=\"20240924\")\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Sanchez\",session=\"20240716\")\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Stellato\",session=\"20240625\")\n",
"# session = get_exp_session(DATAINFOS, proposer=\"Bertrand\",session=\"20240910\")\n",
"\n",
"# display the session metadata\n",
"#display(asdict(session))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"samples = search_samples(session, ignore_names=[\"rack\", \"mount\", \"align\", \"bl_\", \"sample\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sel_sample = 10\n",
"datasets = search_datasets(session, sample=sel_sample)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sel_dataset = 0\n",
"dataset = datasets[sel_dataset]\n",
"load_data(\n",
" session,\n",
" dataset,\n",
" use_fluo_corr=False,\n",
" iskip=1, #: ignore the first point\n",
" istrip=1, #: ignore the last point\n",
" calc_eshift=True,\n",
" merge=True,\n",
" skip_scans=[],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig = plot_data(\n",
" dataset,\n",
" data=\"fluo\",\n",
" ynorm=\"area\",\n",
" show_slide=True,\n",
" show_i0=False,\n",
" show_e0=True,\n",
" show_merge=\"rebin\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "sloth2411",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% 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
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment