dodal.common#
Modules
- dodal.common.group_uuid(name: str) str [source]#
Returns a unique but human-readable string, to assist debugging orchestrated groups.
- Parameters:
name (str) – A human readable name
- Returns:
name appended with a unique string
- Return type:
readable_uid (Group)
- dodal.common.inject(name: str) Any [source]#
Function to mark a defaulted argument of a plan as a reference to a device stored in another context and not available to be referenced directly. Bypasses type checking, returning x as Any and therefore valid as a default argument, leaving handling to the context from which the plan is called. Assumes that device.name is unique. e.g. For a 1-dimensional scan, that is usually performed on a Movable with name “stage_x”
def scan(x: Movable = inject(“stage_x”), start: float = 0.0 …)
- Parameters:
name (str) – Name of a Device to be fetched from an external context
- Returns:
name but without typing checking, valid as any default type
- Return type:
Any
- dodal.common.in_micros(t: float) int [source]#
Converts between a positive number of seconds and an equivalent number of microseconds.
- Parameters:
t (float) – A time in seconds
- Raises:
ValueError – if t < 0
- Returns:
A time in microseconds, rounded up to the nearest whole microsecond,
- Return type:
t (int)
- dodal.common.step_to_num(start: float, stop: float, step: float) Tuple[float, float, int] [source]#
Standard handling for converting from start, stop, step to start, stop, num Forces step to be same direction as length Includes a final point if it is within 1% of the final step, prevents floating point arithmatic errors from giving inconsistent shaped scans between steps of an outer axis.
- Parameters:
start (float) – Start of length, will be returned unchanged
stop (float) – End of length, if length/step does not divide cleanly will be returned extended up to 1% of step, or else truncated.
step (float) – Length of a step along the line formed from start to stop. If stop < start, will be coerced to be backwards.
- Return type:
- Returns:
start, adjusted_stop, num = Tuple[float, float, int] start will be returned unchanged adjusted_stop = start + (num - 1) * step num is the maximal number of steps that could fit into the length.