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

Add durations for startup files loading #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions .ci/bl-specific.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ else
echo "Falling back to use caproto-spoof-beamline IOC"
fi

pip install git+https://github.com/mrakitin/ophyd@inspect-debug-info
echo "##vso[task.setvariable variable=OPHYD_DEBUG_WITH_INSPECT;]1"
2 changes: 2 additions & 0 deletions .ci/drop-in.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
pprint(f'I am in {os.path.abspath(__file__)}')
pprint(sample_stage.read())
pprint(sample_stage.x.component_names)

pprint(durations)
11 changes: 11 additions & 0 deletions startup/00-startup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
print(f'Loading {__file__}...')

import time as ttime

durations = {}

start = ttime.monotonic()

from nslsii import configure_base
from IPython import get_ipython

Expand All @@ -8,3 +16,6 @@

# Optional: set any metadata that rarely changes.
RE.md['beamline_id'] = 'TES-opt'

duration = ttime.monotonic() - start # seconds
durations[__file__] = duration
7 changes: 7 additions & 0 deletions startup/20-motors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
print(f'Loading {__file__}...')

start = ttime.monotonic()

from ophyd import (EpicsSignal, EpicsMotor, Device, Component as Cpt)


Expand All @@ -21,3 +25,6 @@ class SampleStage(Device):
getattr(sample_stage, cpt).llm.put(-1000)
getattr(sample_stage, cpt).hlm.put(1000)
getattr(sample_stage, cpt).velocity.put(5.0)

duration = ttime.monotonic() - start # seconds
durations[__file__] = duration
7 changes: 7 additions & 0 deletions startup/28-optimization_detector_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
print(f'Loading {__file__}...')

start = ttime.monotonic()

import numpy as np
import time as ttime

Expand Down Expand Up @@ -54,3 +58,6 @@ def watch_function(motors, detector, *args, **kwargs):
def stop_detector(detector):
"""Stop detector"""
pass

duration = ttime.monotonic() - start # seconds
durations[__file__] = duration
7 changes: 7 additions & 0 deletions startup/92-optimization.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
print(f'Loading {__file__}...')

start = ttime.monotonic()

import matplotlib.pyplot as plt

# from bloptools.de_opt_utils import run_hardware_fly
Expand All @@ -22,3 +26,6 @@
# RE(optimization_plan(fly_plan=run_hardware_fly, bounds=motor_bounds, db=db, motors=motor_dict,
# detector=None, max_velocity=5, start_det=start_detector, read_det=read_detector,
# stop_det=stop_detector, watch_func=watch_function, threshold=4.5))

duration = ttime.monotonic() - start # seconds
durations[__file__] = duration