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

Use ported classes/functions from mxtools #15

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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 .ci/bl-specific.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

sudo mkdir -v -p /GPFS/CENTRAL/xf17id1/skinnerProjectsBackup/bnlpx_config/fmx_bluesky_config/
sudo chown -Rv $USER: /GPFS/CENTRAL/xf17id1/skinnerProjectsBackup/bnlpx_config/fmx_bluesky_config/
pip install git+https://github.com/NSLS-II-AMX/mxtools.git
pip install git+https://github.com/NSLS-II-AMX/mxtools.git@fmx-profile_collection-classes
7 changes: 2 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ resources:
endpoint: github

jobs:
- template: collection-2021-1.0.yml@templates
parameters:
beamline_acronym: FMX
- template: collection-2021-1.2.yml@templates
- template: nsls2-collection-2021-2.2.yml@templates
parameters:
beamline_acronym: FMX
- template: nsls2-collection-2021-2.2.yml@templates
- template: nsls2-collection-2022-1.0-py39.yml@templates
parameters:
beamline_acronym: FMX
20 changes: 3 additions & 17 deletions startup/21-bpm_00_lsdc.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
from ophyd import Device, EpicsSignal, Component as Cpt, EpicsSignalRO

class Bpm(Device):
x = Cpt(EpicsSignalRO, 'PosX:MeanValue_RBV')
y = Cpt(EpicsSignalRO, 'PosY:MeanValue_RBV')
a = Cpt(EpicsSignalRO, 'Current1:MeanValue_RBV')
b = Cpt(EpicsSignalRO, 'Current2:MeanValue_RBV')
c = Cpt(EpicsSignalRO, 'Current3:MeanValue_RBV')
d = Cpt(EpicsSignalRO, 'Current4:MeanValue_RBV')
sum_x = Cpt(EpicsSignalRO, 'SumX:MeanValue_RBV')
sum_y = Cpt(EpicsSignalRO, 'SumY:MeanValue_RBV')
sum_all = Cpt(EpicsSignalRO, 'SumAll:MeanValue_RBV')
from mxtools.fmx.bpm import Bpm

bpm1 = Bpm('XF:17IDA-BI:FMX{BPM:1}', name='bpm1')
bpm4 = Bpm('XF:17IDC-BI:FMX{BPM:4}', name='bpm4')

bpm1.sum_all.kind = 'hinted'
bpm4.sum_all.kind = 'hinted'

bpm1_sum_all_precision = EpicsSignal('XF:17IDA-BI:FMX{BPM:1}SumAll:MeanValue_RBV.PREC')
bpm1_sum_all_precision.put(10)

bpm4_sum_all_precision = EpicsSignal('XF:17IDC-BI:FMX{BPM:4}SumAll:MeanValue_RBV.PREC')
bpm4_sum_all_precision.put(10)
bpm1.sum_all_precision.put(10)
bpm4.sum_all_precision.put(10)
52 changes: 7 additions & 45 deletions startup/90-utility_00_lsdc.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
from ophyd import Device, Component as Cpt, EpicsSignal, EpicsSignalRO
import socket
from functools import partial
from mxtools.fmx.utility import BeamlineCalibrations, PuckSafety, blStrGet, get_energy


class BeamlineCalibrations(Device):
LoMagCal = Cpt(EpicsSignal, 'LoMagCal}')
HiMagCal = Cpt(EpicsSignal, 'HiMagCal}')

BL_calibration = BeamlineCalibrations('XF:17ID-ES:FMX{Misc-',
name='BL_calibration',
read_attrs=['LoMagCal', 'HiMagCal'])


class PuckSafety(Device):
On = Cpt(EpicsSignal, 'On.PROC')
Off = Cpt(EpicsSignal, 'Off.PROC')

## Robot dewar puck safety system
puck_safety = PuckSafety('XF:17IDC-OP:FMX{DewarSwitch}Seq', name='puck_safety',
read_attrs=[],
labels=['fmx'])

def blStrGet():
"""
Return beamline string

blStr: 'AMX' or 'FMX'

Beamline is determined by querying hostname
"""
hostStr = socket.gethostname()
if hostStr.startswith('xf17id2'):
blStr = 'FMX'
elif hostStr.startswith('xf17id1'):
blStr = 'AMX'
else:
print('Error - this code must be executed on one of the -ca1 machines')
blStr = -1

return blStr


def get_energy():
"""
Returns the current photon energy in eV derived from the DCM Bragg angle
"""

blStr = blStrGet()
if blStr == -1: return -1

if blStr == 'AMX':
energy = vdcm.e.user_readback.get()
elif blStr == 'FMX':
energy = hdcm.e.user_readback.get()

return energy
get_energy = partial(get_energy, hdcm=hdcm)

# Example for unpacking kwargs:
# kwargs = {"param1": "test1",
# "param2": "test2",}

# my_plan = partial(my_plan, **kwargs)
1 change: 1 addition & 0 deletions startup/93-set_energy_00_lsdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def inner():

plt.close(fig)


def ivu_gap_scan(start, end, steps, detector=bpm1, goToPeak=True):
"""
Scans the IVU21 gap against a detector, and moves the gap to the peak plus a
Expand Down