예제 #1
0
from BMM.workspace import initialize_workspace, rkvs
initialize_workspace()

import json, time

DATA = os.path.join(os.getenv('HOME'), 'Data', 'bucket') + '/'
BMM_CONFIGURATION_LOCATION = '/home/xf06bm/git/BMM-beamline-configuration/'

nas_mount_point = '/mnt/nfs/nas1'
nas_path = os.path.join(nas_mount_point, 'xf06bm', 'experiments', 'XAS',
                        'snapshots')

from BMM.functions import now, colored, run_report, boxedtext, elapsed_time
from BMM.functions import error_msg, warning_msg, go_msg, url_msg, bold_msg, verbosebold_msg, list_msg, disconnected_msg, info_msg, whisper
run_report(__file__, text='functions and other basics')
run_report('\t' + 'logging')
from BMM.logging import report, BMM_log_info, BMM_msg_hook

from bluesky.preprocessors import finalize_wrapper

run_report('\t' + 'user')
from BMM.user import BMM_User

## old xafs_linxs sample holder
#run_report('\t'+'reference foils')
#from BMM.referencefoils import ReferenceFoils
#foils = ReferenceFoils()

run_report('\t' + 'detector ROIs')
from BMM.rois import ROI, XSROI
예제 #2
0
import time
from BMM.functions import run_report

run_report(__file__, text='instrument definitions')

TAB = '\t\t\t'

########################################################################
# Note: the use of SynAxis in this file is so that every motor-related #
# symbol gets set to `something' at startup.  This allows bsui to      #
# fully start and places the user at a fully-functional-for-BMM        #
# command line.                                                        #
#                                                                      #
# LOTS of things won't work correctly in this situation. For example,  #
# if M2 is disconnected, then anything that wants to touch M2 will not #
# work, e.g. `%w m2' or any kind of coordinated or non-coordinated     #
# motion.  But this allows one to use and develop BMM's bsui profile   #
# even with multiple motors disconnected.                              #
#                                                                      #
# The most common causes of a disconnected motor are an IOC that is    #
# not running or a controller that is powered down (or both).          #
########################################################################
from ophyd.sim import SynAxis


def wait_for_connection(thing):
    # give it a moment
    count = 0
    while thing.connected is False:
        count += 1
        time.sleep(0.5)
예제 #3
0
import os

from BMM.functions import run_report
from BMM.user_ns.bmm import BMMuser

run_report(__file__, text='dwelltime')

##############################################################
# ______ _    _ _____ _      _    _____ ________  ___ _____  #
# |  _  \ |  | |  ___| |    | |  |_   _|_   _|  \/  ||  ___| #
# | | | | |  | | |__ | |    | |    | |   | | | .  . || |__   #
# | | | | |/\| |  __|| |    | |    | |   | | | |\/| ||  __|  #
# | |/ /\  /\  / |___| |____| |____| |  _| |_| |  | || |___  #
# |___/  \/  \/\____/\_____/\_____/\_/  \___/\_|  |_/\____/  #
##############################################################


with_quadem, with_struck, with_dualem, with_xspress3 = True, False, False, True

# An error gets triggered during Azure CI testing that does not get triggered when
# running under IPython. This disables the Xspress3 during testing.
# This is a crude stopgap.
# See https://dev.azure.com/nsls2/profile_collections/_build/results?buildId=2609&view=results
if os.environ.get('AZURE_TESTING'):
    with_xspress3 = False

if with_xspress3 is True:
    BMMuser.readout_mode = 'xspress3'
from BMM.dwelltime import LockedDwellTimes
예제 #4
0
from IPython.core.magic import register_line_magic  #, register_cell_magic, register_line_cell_magic)
from BMM.functions import run_report
from BMM.user_ns.bmm import BMMuser

run_report(__file__, text='ipython magics for BMM ... general help: %h')

from BMM.prompt import BMM_help, BMM_keys


@register_line_magic
def h(line):
    '''BMM help text'''
    BMM_help()
    return None


@register_line_magic
def k(line):
    '''help on ipython keyboard shortcuts'''
    BMM_keys()
    return None


from BMM.user_ns.utilities import su, show_vacuum, sw


@register_line_magic
def ut(line):
    '''show BMM utilities status'''
    su()
    return None
예제 #5
0
from BMM.functions import run_report
run_report(__file__, text='Monochromator definitions')

from BMM.user_ns.instruments import wait_for_connection
from BMM.motors import FMBOEpicsMotor, VacuumEpicsMotor, XAFSEpicsMotor, DeadbandEpicsMotor
from BMM.user_ns.motors import mcs8_motors

# see comment at top of BMM/user_ns/instruments.py
from ophyd.sim import SynAxis

TAB = '\t\t\t'

dcm = False
from BMM.dcm import DCM
#from BMM.user_ns.motors import dcm_x

dcm = DCM('XF:06BMA-OP{Mono:DCM1-Ax:', name='dcm', crystal='111')
wait_for_connection(dcm)

print(f'{TAB}FMBO motor group: dcm')
if dcm.connected is True:
    if hasattr(dcm.bragg,
               'tolerance'):  # relevant to Jamie's DeadbandEpicsMotor
        dcm.bragg.tolerance.put(0.0001)

    dcm_bragg = XAFSEpicsMotor('XF:06BMA-OP{Mono:DCM1-Ax:Bragg}Mtr',
                               name='dcm_bragg')
    dcm_pitch = VacuumEpicsMotor('XF:06BMA-OP{Mono:DCM1-Ax:P2}Mtr',
                                 name='dcm_pitch')
    dcm_roll = VacuumEpicsMotor('XF:06BMA-OP{Mono:DCM1-Ax:R2}Mtr',
                                name='dcm_roll')
예제 #6
0
from ophyd import EpicsSignalRO

from BMM.functions import run_report, boxedtext
from BMM.functions import error_msg, warning_msg, go_msg, url_msg, bold_msg, verbosebold_msg, list_msg, disconnected_msg, info_msg, whisper
from BMM.utilities import Vacuum, TCG, FEVac, GateValve, Thermocouple, OneWireTC, BMM_DIWater

run_report(__file__, text='monitor utilities')

#############################
# beamline enabled/disabled #
#############################

try:
    bl_enabled = EpicsSignalRO('SR:C06-EPS{PLC:1}Sts:BM_BE_Enbl-Sts',
                               name='enabled')
except:
    bl_enabled = 0

#####################
# state of shutters #
#####################

from BMM.user_ns.instruments import shb, bmps, idps


def ocd(text, signal):
    '''Indicated open/close/disconnected state with suitable text coloring.
    '''
    outtext = text
    try:
        if signal.connected is False:
예제 #7
0
from BMM.functions import run_report

run_report('\t'+'bsui prompt')

from BMM.prompt import BMMPrompt, BMM_help, BMM_keys
ip = get_ipython()
ip.prompts = BMMPrompt(ip)

예제 #8
0
    # TODO: delete this when 'bluesky_queueserver' is distributed as part of collection environment
    def is_re_worker_active():
        return False


import os, textwrap
from BMM.functions import run_report, disconnected_msg, error_msg, whisper, boxedtext
from BMM.workspace import rkvs

from BMM import user_ns as user_ns_module
user_ns = vars(user_ns_module)

from BMM.user_ns.bmm import BMM_CONFIGURATION_LOCATION, BMMuser, rois
from BMM.user_ns.motors import mcs8_motors

run_report(__file__, text='import the rest of the things')

run_report('\t' + 'resting state')
from BMM.resting_state import resting_state, resting_state_plan, end_of_macro

run_report('\t' + 'motor status reporting')
from BMM.motor_status import motor_metadata, motor_status, ms, motor_sidebar, xrd_motors, xrdm

run_report('\t' + 'derived plot')
from BMM.derivedplot import close_all_plots, close_last_plot, interpret_click

run_report('\t' + 'suspenders')
from BMM.suspenders import BMM_suspenders, BMM_clear_to_start, BMM_clear_suspenders

run_report('\t' + 'linescan, rocking curve, slit_height, pluck')
from BMM.linescans import linescan, pluck, rocking_curve, slit_height, ls2dat, find_slot, rectangle_scan
예제 #9
0
from BMM.functions import run_report
from BMM.metadata import TC, Ring

from BMM import user_ns as user_ns_module
user_ns = vars(user_ns_module)

run_report(__file__, text='miscellaneous metadata and the baseline')

first_crystal = TC('XF:06BMA-OP{Mono:DCM-Crys:1}', name='first_crystal')
compton_shield = TC('XF:06BMA-OP{Mono:DCM-Crys:1-Ax:R}', name='compton_shield')

ring = Ring('SR', name='ring')

from BMM.user_ns.dcm import *
from BMM.user_ns.motors import *
from BMM.user_ns.instruments import *  #xafs_wheel, xafs_ref, slits2, slits3, m2, m3, xafs_table, m2_bender

user_ns['sd'].baseline = (
    xafs_linx,
    xafs_liny,
    xafs_pitch,
    xafs_wheel,
    xafs_ref,
    xafs_det,  #xafs_roll, xafs_linxs, xafs_roth, xafs_rots,
    dm3_bct,
    dm3_foils,
    dm2_fs,
    dcm_x,
    dcm_pitch,
    dcm_roll,
    slits3.top,
예제 #10
0
import os, json
from BMM.functions import run_report
from BMM.user_ns.bmm import BMMuser
from ophyd import EpicsSignal

run_report(__file__, text='detectors and cameras')

with_pilatus = False


##########################################
#  _____ ___________ _   _ _____  _   __ #
# /  ___|_   _| ___ \ | | /  __ \| | / / #
# \ `--.  | | | |_/ / | | | /  \/| |/ /  #
#  `--. \ | | |    /| | | | |    |    \  #
# /\__/ / | | | |\ \| |_| | \__/\| |\  \ #
# \____/  \_/ \_| \_|\___/ \____/\_| \_/ #
##########################################
                                      
                                      

run_report('\t'+'Struck')
from BMM.struck import BMMVortex, GonioStruck, icrs, ocrs

vor = BMMVortex('XF:06BM-ES:1{Sclr:1}', name='vor')
icrs['XF:06BM-ES:1{Sclr:1}.S3']  = vor.channels.chan7
icrs['XF:06BM-ES:1{Sclr:1}.S4']  = vor.channels.chan8
icrs['XF:06BM-ES:1{Sclr:1}.S5']  = vor.channels.chan9
icrs['XF:06BM-ES:1{Sclr:1}.S6']  = vor.channels.chan10
예제 #11
0
from ophyd.sim import SynAxis
from ophyd import EpicsMotor, EpicsSignalRO
from BMM.functions import run_report, error_msg, warning_msg, bold_msg
import time

run_report(__file__, text='individual motor definitions')

from BMM.motors import FMBOEpicsMotor, XAFSEpicsMotor, VacuumEpicsMotor, EndStationEpicsMotor

TAB = '\t\t\t'

mcs8_motors = list()

## front end slits
print(f'{TAB}Front end slit motor group')
fe_slits_horizontal1 = EpicsMotor('FE:C06B-OP{Slt:1-Ax:Hrz}Mtr',
                                  name='fe_slits_horizontal1')
fe_slits_incline1 = EpicsMotor('FE:C06B-OP{Slt:1-Ax:Inc}Mtr',
                               name='fe_slits_incline1')
fe_slits_o = EpicsMotor('FE:C06B-OP{Slt:1-Ax:O}Mtr', name='fe_slits_o')
fe_slits_t = EpicsMotor('FE:C06B-OP{Slt:1-Ax:T}Mtr', name='fe_slits_t')
fe_slits_horizontal2 = EpicsMotor('FE:C06B-OP{Slt:2-Ax:Hrz}Mtr',
                                  name='fe_slits_horizontal2')
fe_slits_incline2 = EpicsMotor('FE:C06B-OP{Slt:2-Ax:Inc}Mtr',
                               name='fe_slits_incline2')
fe_slits_i = EpicsMotor('FE:C06B-OP{Slt:2-Ax:I}Mtr', name='fe_slits_i')
fe_slits_b = EpicsMotor('FE:C06B-OP{Slt:2-Ax:B}Mtr', name='fe_slits_b')
fe_slits_hsize = EpicsSignalRO('FE:C06B-OP{Slt:12-Ax:X}size',
                               name='fe_slits_hsize')
fe_slits_vsize = EpicsSignalRO('FE:C06B-OP{Slt:12-Ax:Y}size',
                               name='fe_slits_vsize')