Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

resolve problems with mode_USAXS() and subroutines #95

Closed
prjemian opened this issue Dec 7, 2018 · 9 comments
Closed

resolve problems with mode_USAXS() and subroutines #95

prjemian opened this issue Dec 7, 2018 · 9 comments
Assignees
Labels
bug Something isn't working high priority more urgent

Comments

@prjemian
Copy link
Contributor

prjemian commented Dec 7, 2018

testing mode_USAXS(), resolve various exceptions from other methods that this calls

@prjemian prjemian added bug Something isn't working high priority more urgent labels Dec 7, 2018
@prjemian prjemian added this to the 2018-3 operations milestone Dec 7, 2018
@prjemian prjemian self-assigned this Dec 7, 2018
@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

Note that summarize_plan(mode_USAXS()) succeeds yet RE(mode_USAXS()) raises exceptions.

@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

LimitError: Value 69.67625 outside of range: [79.67625, 79.67999999999995] due to

/home/beams11/USAXS/.ipython/profile_bluesky/startup/41-commands.py in move_USAXSIn()
    251         a_stage.x,          terms.SAXS.ax_in.value,
    252         d_stage.x,          terms.SAXS.dx_in.value,
--> 253         d_stage.y,          terms.USAXS.DY0.value,
    254     )
    255 

but the values clearly belong to the DX stage:

In [7]: d_stage.x.read()
Out[7]: 
OrderedDict([('d_stage_x_soft_limit_lo',
              {'value': 79.67625, 'timestamp': 1544202813.906183}),
             ('d_stage_x_soft_limit_hi',
              {'value': 79.67999999999995, 'timestamp': 1544202813.906183}),
             ('d_stage_x',
              {'value': 69.68000000000006, 'timestamp': 1544202099.578324}),
             ('d_stage_x_user_setpoint',
              {'value': 69.68000000000006, 'timestamp': 1544202813.906183})])

@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

@kmpeters: The lower soft limit for DX (79.67625) is above the targeted position (69.67625) and ophyd prevents the move command from being sent. Funny that EPICS is allowing the motor to move positive (not negative) to a value that is below the upper limit, even though that value is below the upper limit!

I'll set the DX lower limit slightly lower than 69.67625 just to get past this.

prjemian pushed a commit that referenced this issue Dec 7, 2018
@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

AttributeError: set while moving DX (see above)

In [22]: RE(mode_USAXS())
Found UsaxsSaxsMode = 65535
Moving to proper USAXS mode
Moving WAXS out of beam
Removed WAXS from beam position
Moving SAXS out of beam
Removed SAXS from beam position
Moving to USAXS mode
USAXS is in position                                                                                                                   
Preparing for USAXS mode ... please wait ...                                                                                           
---------------------------------------------------------------------------                                                            
KeyError                                  Traceback (most recent call last)                                                            
/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/ophyd/device.py in __getattr__(self, name)
    983                 # Initial access of signal
--> 984                 cpt = self._sig_attrs[name]
    985                 return cpt.__get__(self, None)

KeyError: 'set'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-22-125c5b6feaa6> in <module>()
----> 1 RE(mode_USAXS())

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw)
    742                     # it (unless it is a canceled error)
    743                     if exc is not None:
--> 744                         raise exc
    745 
    746             if self._interrupted:

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/run_engine.py in _run(self)
   1251             self.log.error("Run aborted")
   1252             self.log.error("%r", err)
-> 1253             raise err
   1254         finally:
   1255             # Some done_callbacks may still be alive in other threads.

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/run_engine.py in _run(self)
   1115                         try:
   1116                             msg = self._plan_stack[-1].throw(
-> 1117                                 self._exception or resp)
   1118                         except Exception as e:
   1119                             # The current plan did not handle it,

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in __call__(self, plan)
   1292         plan = monitor_during_wrapper(plan, self.monitors)
   1293         plan = baseline_wrapper(plan, self.baseline)
-> 1294         return (yield from plan)

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in baseline_wrapper(plan, devices, name)
   1147         return (yield from plan)
   1148     else:
-> 1149         return (yield from plan_mutator(plan, insert_baseline))
   1150 
   1151 

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     75             # if we have a stashed exception, pass it along
     76             try:
---> 77                 msg = plan_stack[-1].throw(exception)
     78             except StopIteration as e:
     79                 # discard the exhausted generator

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in monitor_during_wrapper(plan, signals)
    788     plan1 = plan_mutator(plan, insert_after_open)
    789     plan2 = plan_mutator(plan1, insert_before_close)
--> 790     return (yield from plan2)
    791 
    792 

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     75             # if we have a stashed exception, pass it along
     76             try:
---> 77                 msg = plan_stack[-1].throw(exception)
     78             except StopIteration as e:
     79                 # discard the exhausted generator

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     75             # if we have a stashed exception, pass it along
     76             try:
---> 77                 msg = plan_stack[-1].throw(exception)
     78             except StopIteration as e:
     79                 # discard the exhausted generator

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in fly_during_wrapper(plan, flyers)
    846     plan1 = plan_mutator(plan, insert_after_open)
    847     plan2 = plan_mutator(plan1, insert_before_close)
--> 848     return (yield from plan2)
    849 
    850 

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     75             # if we have a stashed exception, pass it along
     76             try:
---> 77                 msg = plan_stack[-1].throw(exception)
     78             except StopIteration as e:
     79                 # discard the exhausted generator

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     75             # if we have a stashed exception, pass it along
     76             try:
---> 77                 msg = plan_stack[-1].throw(exception)
     78             except StopIteration as e:
     79                 # discard the exhausted generator

/home/beams11/USAXS/.ipython/profile_bluesky/startup/43-procedures.py in mode_USAXS()
     54         # put detector stage in position
     55         d_stage.x, terms.USAXS.diode.dx.value,
---> 56         d_stage.y, terms.USAXS.diode.dy.value,
     57     )
     58     yield from bps.sleep(0.1)   # TODO: still needed?

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/plan_stubs.py in mv(*args)
    243     step, = utils.merge_cycler(cyl)
    244     for obj, val in step.items():
--> 245         ret = yield Msg('set', obj, val, group=group)
    246         status_objects.append(ret)
    247     yield Msg('wait', None, group=group)

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    192         try:
    193             # yield out the 'current message' and collect the return
--> 194             inner_ret = yield msg
    195         except GeneratorExit:
    196             # special case GeneratorExit.  We must clean up all of our plans

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    192         try:
    193             # yield out the 'current message' and collect the return
--> 194             inner_ret = yield msg
    195         except GeneratorExit:
    196             # special case GeneratorExit.  We must clean up all of our plans

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    192         try:
    193             # yield out the 'current message' and collect the return
--> 194             inner_ret = yield msg
    195         except GeneratorExit:
    196             # special case GeneratorExit.  We must clean up all of our plans

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    192         try:
    193             # yield out the 'current message' and collect the return
--> 194             inner_ret = yield msg
    195         except GeneratorExit:
    196             # special case GeneratorExit.  We must clean up all of our plans

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    192         try:
    193             # yield out the 'current message' and collect the return
--> 194             inner_ret = yield msg
    195         except GeneratorExit:
    196             # special case GeneratorExit.  We must clean up all of our plans

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/run_engine.py in _run(self)
   1195                         # exceptions (coming in via throw) can be
   1196                         # raised
-> 1197                         new_response = yield from coro(msg)
   1198 
   1199                     # special case `CancelledError` and let the outer

/APSshare/anaconda3/BlueSky/lib/python3.6/asyncio/coroutines.py in coro(*args, **kw)
    210         @functools.wraps(func)
    211         def coro(*args, **kw):
--> 212             res = func(*args, **kw)
    213             if (base_futures.isfuture(res) or inspect.isgenerator(res) or
    214                 isinstance(res, CoroWrapper)):

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/bluesky/run_engine.py in _set(self, msg)
   1943         group = kwargs.pop('group', None)
   1944         self._movable_objs_touched.add(msg.obj)
-> 1945         ret = msg.obj.set(*msg.args, **kwargs)
   1946         p_event = asyncio.Event(loop=self.loop)
   1947         pardon_failures = self._pardon_failures

/APSshare/anaconda3/BlueSky/lib/python3.6/site-packages/ophyd/device.py in __getattr__(self, name)
    985                 return cpt.__get__(self, None)
    986             except KeyError:
--> 987                 raise AttributeError(name)
    988 
    989         attr_names = name.split('.')

AttributeError: set

@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

Something else is causing this. Start to test the components inside mode_USAXS().

prjemian pushed a commit that referenced this issue Dec 7, 2018
@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

During In [28]: RE(move_WAXSOut()), this LimitError: Value 0.0 outside of range: [5.0, 255.0] due to

     66     # move the WAXS X away from sample
---> 67     yield from bps.mv(waxsx, terms.WAXS.x_out.value)

@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

These are the limits on waxsx:

In [29]: waxsx.read()
Out[29]: 
OrderedDict([('waxsx_soft_limit_lo',
              {'value': 5.0, 'timestamp': 1544205945.638347}),
             ('waxsx_soft_limit_hi',
              {'value': 255.0, 'timestamp': 1544205945.638347}),
             ('waxsx', {'value': 250.0, 'timestamp': 1544205939.455014}),
             ('waxsx_user_setpoint',
              {'value': 250.0, 'timestamp': 1544205945.638347})])

manually adjust waxs lower limit to 0, to resolve

prjemian pushed a commit that referenced this issue Dec 7, 2018
@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

@jilavsky -- note current positions and limits

In [20]: wa saxs
saxs
  Positioner                     Value       Low Limit   High Limit  Offset     
  saxs_stage_x                   -0.00104    -19.0       11.0        19.81771   
  saxs_stage_y                   13.5        10.5        257.0       324.665    
  saxs_stage_z                   50.0002     47.9993     48.0        -757.5393  

  Local variable name                    Ophyd name (to be recorded as metadata)
  saxs_stage.x                           saxs_stage_x                          
  saxs_stage.y                           saxs_stage_y                          
  saxs_stage.z                           saxs_stage_z                          
  pin_z                                  saxs_stage_z                          

@prjemian
Copy link
Contributor Author

prjemian commented Dec 7, 2018

Bypass these motor soft limits problems for now and resolve in #96

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working high priority more urgent
Projects
None yet
Development

No branches or pull requests

1 participant