bluesky / suitcase-core

data export facilities for NSLS-II
https://blueskyproject.io/suitcase
Other
2 stars 13 forks source link

_get_motor_name(start) returns 'seq_num' rather than motor name #80

Closed whs92 closed 3 years ago

whs92 commented 3 years ago

_get_motor_name(start) should return the motor name from the start document it's passed. This is then added to the spec scan header

At the moment the motor_name is always returned as seq_num because the plan_name returned by get_plan_name(start) returns the spec name for the scan rather than the bluesky name for the scan. For example in the start document below the plan name is scan. This get's translated to the spec name ascan. When this is checked against _BLUESKY_PLAN_NAMES it can't find it because it should be looking from scan and not ascan.

#S 2 ascan seq_num -1

Should be

#S 2 ascan motor -1

I guess you could fix it by either replacing _BLUESKY_PLAN_NAMES with _SPEC_PLAN_NAMES on line 153, or by just not translating from bluesky to spec. I think the problem also exists in other parts of this file where the scan_command is checked against _BLUESKY_PLAN_NAMES for example here

Start({'detectors': ['det'],
 'hints': {'dimensions': [[['motor'], 'primary']]},
 'motors': ['motor'],
 'num_intervals': 79,
 'num_points': 80,
 'plan_args': {'args': ["SynAxis(prefix='', name='motor', "
                        "read_attrs=['readback', 'setpoint'], "
                        "configuration_attrs=['velocity', 'acceleration'])",
                        -1,
                        1],
               'detectors': ["SynGauss(prefix='', name='det', "
                             "read_attrs=['val'], configuration_attrs=['Imax', "
                             "'center', 'sigma', 'noise', "
                             "'noise_multiplier'])"],
               'num': 80,
               'per_step': 'None'},
 'plan_name': 'scan',
 'plan_pattern': 'inner_product',
 'plan_pattern_args': {'args': ["SynAxis(prefix='', name='motor', "
                                "read_attrs=['readback', 'setpoint'], "
                                "configuration_attrs=['velocity', "
                                "'acceleration'])",
                                -1,
                                1],
                       'num': 80},
 'plan_pattern_module': 'bluesky.plan_patterns',
 'plan_type': 'generator',
 'scan_id': 2,
 'time': 1618213904.8841407,
 'uid': '1d4b56b7-f24a-4502-a295-79cb89092604'})