Skip to content

Commit 7310f43

Browse files
author
FXI Operator
committed
merged tacaswell/pixi
2 parents 6dd5293 + c8cc74f commit 7310f43

File tree

7 files changed

+10818
-41
lines changed

7 files changed

+10818
-41
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ startup/calib_copy_Feb10_2019.csv
1616
startup/hs_err_pid7527.log
1717
startup/existing_plans_and_devices.yaml
1818
.vscode/
19+
# pixi environments
20+
.pixi/*
21+
!.pixi/config.toml

pixi.lock

Lines changed: 10698 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[workspace]
2+
channels = ["conda-forge"]
3+
name = "fxi-profile-collection"
4+
platforms = ["linux-64"]
5+
version = "2025.3.1"
6+
7+
[system-requirements]
8+
libc = "2.17"
9+
10+
[feature.profile.dependencies]
11+
bluesky-base = "==1.14.6"
12+
bluesky-queueserver = "*"
13+
matplotlib-base= ">=3.9.3,<4"
14+
networkx = ">=3.4.2,<4"
15+
nslsii = "==0.11.4"
16+
numpy = "*"
17+
ophyd = ">=1.11.0"
18+
pyepics = "*"
19+
python = ">=3.12,<3.13"
20+
semver = ">=3.0.4,<4"
21+
tiled-client = ">=0.1.6"
22+
qtpy = ">=2.4.3,<3"
23+
pyqt = "<6"
24+
reportlab = ">=4.4.1,<5"
25+
cytoolz = ">=1.0.1,<2"
26+
pypdf2 = ">=3.0.1,<4"
27+
scipy = ">=1.16.1,<2"
28+
tomopy = ">=1.14.4"
29+
magicgui = ">=0.10.1,<0.11"
30+
pystackreg = ">=0.2.8,<0.3"
31+
hdf5-external-filter-plugins = ">=0.1.0,<0.2"
32+
blosc-hdf5-plugin = ">=1.0.1,<2"
33+
databroker = "==2.0.0"
34+
epicscorelibs = ">=7.0.7.99.1.1,<8"
35+
bluesky-tiled-plugins = ">=2.0.0b68"
36+
ophyd-async = ">=0.13.7,<0.14"
37+
38+
39+
[feature.profile.pypi-dependencies]
40+
pvxslibs = ">=1.3.2, <2"
41+
42+
43+
[feature.qs.dependencies]
44+
bluesky-queueserver = "*"
45+
bluesky-httpserver = "*"
46+
47+
[feature.qs.tasks]
48+
# This section needs some development work to understand the best way to
49+
# thread the required configuration through both the task and files checked into
50+
# the profile. These will interact with the ansible roles for pushing out the
51+
# systemd units
52+
qs-backend = "start-re-manager --profile-dir=."
53+
qs-server = "uvicorn --host localhost --port 60610 bluesky_httpserver.server:app"
54+
55+
56+
[feature.terminal.dependencies]
57+
ipython = ">=9.5.0"
58+
pyside6 = "*"
59+
numpy = ">2"
60+
61+
62+
[feature.terminal.tasks]
63+
start = "unset SESSION_MANAGER PYTHONPATH && MPLBACKEND=qtagg ipython --profile-dir=."
64+
pvs = "ipython --profile-dir=. -c 'get_pv_types(); exit()'"
65+
66+
[environments]
67+
terminal = {features=["profile", "terminal"], solve-group="profile"}
68+
qs = {features=["profile", "qs"], solve-group="profile"}

startup/41-scans.py

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
try:
19-
from cytools import partition
19+
from cytoolz import partition
2020
except ImportError:
2121
from toolz import partition
2222
from bluesky import plan_patterns
@@ -319,12 +319,12 @@ def fly_scan(
319319
@bpp.monitor_during_decorator([zps.pi_r])
320320
@run_decorator(md=_md)
321321
def fly_inner_scan():
322-
322+
323323
for flt in filters:
324324
yield from mv(flt, 1)
325325
yield from mv(flt, 1)
326326
yield from bps.sleep(1)
327-
327+
328328
# close shutter, dark images: numer=chunk_size (e.g.20)
329329
print("\nshutter closed, taking dark images...")
330330
yield from _take_dark_image(
@@ -351,7 +351,7 @@ def fly_inner_scan():
351351
print("\nTaking background images...")
352352
yield from _set_rotation_speed(rs=rot_back_velo)
353353
# yield from abs_set(zps.pi_r.velocity, rs)
354-
354+
355355
for flt in filters:
356356
yield from mv(flt, 1)
357357
yield from mv(flt, 1)
@@ -402,7 +402,7 @@ def radiography_scan(
402402
num_bkg=10,
403403
take_dark_img=True,
404404
relative_move_flag=1,
405-
rot_first_flag=1,
405+
rot_first_flag=1,
406406
note="",
407407
simu=False,
408408
md=None,
@@ -579,7 +579,7 @@ def fly_scan(
579579
rotation speed in unit of deg/sec
580580
581581
take_bkg_img: bool, default is True,
582-
check if need to take background image (without sample)
582+
check if need to take background image (without sample)
583583
584584
take_dark_img: bool, default is True,=True,
585585
check if need to take dark image (shutter closed)
@@ -603,7 +603,7 @@ def fly_scan(
603603
motor_y_ini = zps.sy.position
604604
motor_z_ini = zps.sz.position
605605
motor_r_ini = zps.pi_r.position
606-
606+
607607
out_r_frac = out_r - (out_r // 360) * 360
608608
out_r_relative = ((target_rot_angle-1) // 360) * 360 + out_r_frac
609609

@@ -623,7 +623,7 @@ def fly_scan(
623623

624624
motor = [zps.sx, zps.sy, zps.sz, zps.pi_r]
625625

626-
626+
627627
_md = {
628628
"detectors": ["KinetixU"],
629629
"motors": [mot.name for mot in motor],
@@ -703,7 +703,7 @@ def fly_inner_scan():
703703
###########################################################################
704704

705705
rot_time = np.abs(relative_rot_angle) / np.abs(rs) + 1 # it seems acceleration/de-acceleration take more time
706-
num_img = int(rot_time / true_period)
706+
num_img = int(rot_time / true_period)
707707

708708
yield from _open_shutter(simu=simu)
709709
print("\nshutter opened, taking tomo images...")
@@ -957,7 +957,7 @@ def xanes_inner_scan():
957957
repeat=2,
958958
trans_first_flag=rot_first_flag,
959959
)
960-
'''
960+
'''
961961
if len(filters):
962962
for filt in filters:
963963
yield from mv(filt, 0)
@@ -1497,7 +1497,7 @@ def stop(self, doc):
14971497
eng_start = plan_args["start"]
14981498
eng_end = plan_args["stop"]
14991499
steps = plan_args["num"]
1500-
try:
1500+
try:
15011501
x = plan_args['eng_list']
15021502
except:
15031503
x = np.linspace(eng_start, eng_end, steps)
@@ -1516,7 +1516,7 @@ def stop(self, doc):
15161516
y0 = np.array(list(h.data(ic3.name)))
15171517
y1 = np.array(list(h.data(ic4.name)))
15181518
r = np.log(y0 / y1)
1519-
1519+
15201520
self._ax1.plot(x, y0, ".-", label=f'{ic3.name}')
15211521
self._ax1.plot(x, y1, ".-", label=f'{ic4.name}')
15221522
self._ax1.legend()
@@ -1916,13 +1916,13 @@ def raster_2D_scan(
19161916
"""
19171917
!!! Note:
19181918
1919-
Filters will be inserted at all time, including: img, img_bkg, and img_dark
1920-
1919+
Filters will be inserted at all time, including: img, img_bkg, and img_dark
1920+
19211921
19221922
scanning large area by moving samples at different 2D block position, defined by x_range and y_range, only work for KinetixU camera at full resolution (2048 x 2048)
19231923
for example, set x_range=[-1,1] and y_range=[-2, 2] will totally take 3 x 5 = 15 images and stitch them together
1924-
1925-
1924+
1925+
19261926
Inputs:
19271927
-------
19281928
@@ -2043,7 +2043,7 @@ def raster_2D_scan(
20432043
@run_decorator(md=_md)
20442044
def raster_2D_inner():
20452045
select_filters(filters)
2046-
2046+
20472047
# take dark image
20482048
print("take 5 dark image")
20492049
yield from _take_dark_image(
@@ -2126,19 +2126,19 @@ def raster_2D_scan_modify(
21262126
scan_x_flag=1,
21272127
flag_take_dark_img=True,
21282128
flag_take_bkg_img=True,
2129-
flag_close_shutter=True,
2129+
flag_close_shutter=True,
21302130
md=None,
21312131
):
21322132
"""
21332133
!!! Note:
21342134
2135-
Filters will be inserted at all time, including: img, img_bkg, and img_dark
2136-
2135+
Filters will be inserted at all time, including: img, img_bkg, and img_dark
2136+
21372137
21382138
scanning large area by moving samples at different 2D block position, defined by x_range and y_range, only work for KinetixU camera at full resolution (2048 x 2048)
21392139
for example, set x_range=[-1,1] and y_range=[-2, 2] will totally take 3 x 5 = 15 images and stitch them together
2140-
2141-
2140+
2141+
21422142
Inputs:
21432143
-------
21442144
@@ -2258,7 +2258,7 @@ def raster_2D_scan_modify(
22582258
@stage_decorator(list(detectors) + motor)
22592259
@run_decorator(md=_md)
22602260
def raster_2D_inner():
2261-
2261+
22622262
# take dark image
22632263
if flag_take_dark_img:
22642264
print("take 5 dark image")
@@ -2348,7 +2348,7 @@ def raster_2D_scan_filter_bkg(
23482348
23492349
!!! Note:
23502350
2351-
Filters will ONLY be inserted when taking background image
2351+
Filters will ONLY be inserted when taking background image
23522352
23532353
23542354
scanning large area by moving samples at different 2D block position, defined by x_range and y_range, only work for KinetixU camera at full resolution (2048 x 2048)
@@ -2609,7 +2609,7 @@ def raster_2D_scan_individal_bkg(
26092609
global ZONE_PLATE
26102610
motor = [zps.sx, zps.sy, zps.sz, zps.pi_r]
26112611
detectors = [KinetixU, ic3]
2612-
2612+
26132613
motor_x_ini = zps.sx.position
26142614
motor_y_ini = zps.sy.position
26152615
motor_z_ini = zps.sz.position
@@ -3299,7 +3299,7 @@ def raster_2D_xanes2(
32993299
):
33003300

33013301
'''
3302-
take 2D-xanes at defined grid position, using "multipos_2D_xanes_scan2"
3302+
take 2D-xanes at defined grid position, using "multipos_2D_xanes_scan2"
33033303
'''
33043304

33053305
motor_x_ini = zps.sx.position
@@ -3814,4 +3814,3 @@ def tomo_mosaic_scan(
38143814
txt4 = "\n###### mosaic tomogrpahy scan finished ######"
38153815
txt = txt1 + txt4 + txt3
38163816
insert_text(txt)
3817-

startup/44-scans_other.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ def test_scan(
2020
out_r=0,
2121
period=0.1,
2222
num_img=10,
23+
<<<<<<< HEAD
2324
num_bkg=10,
2425
relative_move_flag=False,
2526
sleep_time=0,
2627
rot_first_flag=1,
28+
=======
29+
#num_bkg=10,
30+
relative_move_flag=False,
31+
sleep_time=0,
32+
rot_first_flag=1,
33+
>>>>>>> tacaswell/pixi
2734
close_shutter_in_scan=False,
2835
note="",
29-
36+
3037
simu=False,
3138
md=None,
3239
):
@@ -140,7 +147,7 @@ def inner_scan():
140147
'''
141148
yield from mv(zps.pi_r, r_out)
142149
yield from mv(zps.sz, z_out)
143-
yield from mv(zps.sx, x_out, zps.sy, y_out)
150+
yield from mv(zps.sx, x_out, zps.sy, y_out)
144151
for i in range(num_bkg):
145152
yield from trigger_and_read(list(detectors))
146153
'''
@@ -153,7 +160,7 @@ def inner_scan():
153160
# close shutter, taking dark image
154161
yield from _close_shutter(simu=simu)
155162
'''
156-
163+
157164
print('move sample back to initial position')
158165
yield from _move_sample_in(
159166
motor_x_ini,
@@ -192,7 +199,7 @@ def test_scan2(
192199
take_dark_img=True,
193200
take_bkg_img=True,
194201
relative_move_flag=1,
195-
rot_first_flag=1,
202+
rot_first_flag=1,
196203
close_shutter_at_end=True,
197204
note="",
198205
simu=False,
@@ -303,7 +310,7 @@ def inner_scan():
303310
yield from _take_image(detectors, motors, num=1, stream_name="primary")
304311
if close_shutter_at_end:
305312
yield from _close_shutter(simu=simu)
306-
313+
307314

308315
uid = yield from inner_scan()
309316
yield from mv(KinetixU.cam.image_mode, 2)
@@ -365,12 +372,12 @@ def z_scan(
365372
x_out = x_ini + out_x if not (out_x is None) else x_ini
366373
y_out = y_ini + out_y if not (out_y is None) else y_ini
367374
z_out = z_ini + out_z if not (out_z is None) else z_ini
368-
375+
369376
else:
370377
x_out = out_x if not (out_x is None) else x_ini
371378
y_out = out_y if not (out_y is None) else y_ini
372379
z_out = out_z if not (out_z is None) else z_ini
373-
380+
374381

375382
if scan_motor == 'zp_x':
376383
zp_ini = zp.x.position # zp.x intial position
@@ -970,7 +977,7 @@ def load_cell_scan(
970977
pos_list = pbsl_y_pos_list[::-1]
971978
else:
972979
pos_list = pbsl_y_pos_list.copy()
973-
idx += 1
980+
idx += 1
974981
for pbsl_pos in pos_list:
975982
yield from mv(pbsl.y_ctr, pbsl_pos)
976983
for i in range(num):
@@ -1135,7 +1142,7 @@ def beam_profile_scan(
11351142
mot = pbsl.y_ctr
11361143
elif dir == 'x':
11371144
pbsl_ctr_ini = pbsl.x_ctr.position
1138-
mot = pbsl.x_ctr
1145+
mot = pbsl.x_ctr
11391146

11401147
pbsl_pos_list = np.linspace(start, end, steps, endpoint=True)
11411148
num_pbsl_pos = steps
@@ -1591,7 +1598,7 @@ def knife_edge_scan_for_condensor(
15911598
from numpy import polyfit, poly1d
15921599
from scipy.optimize import curve_fit, least_squares
15931600
from scipy.special import erf
1594-
from scipy.signal import gaussian
1601+
from scipy.signal.windows import gaussian
15951602

15961603
yield from rel_grid_scan(
15971604
det,

0 commit comments

Comments
 (0)