slicops package

slicops package

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

Subpackages

Submodules

slicops.config module

Common configuration

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

slicops.config.cfg()[source]

PKDict of common configuration.

db_api

api_uri, tcp_ip, tcp_port, and vue_port values. PKDict is compatible with pykern.api.server.start,

Returns:

configuration values. (Make a copy before modifying.)

Return type:

PKDict

slicops.const module

Constants

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

slicops.ctx module

Holds fields and ui_layout

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.ctx.Ctx(name, title, path=None)[source]

Bases: object

as_dict()[source]
first_time()[source]
class slicops.ctx.Txn(ctx)[source]

Bases: object

commit(update)[source]
field_names()[source]
field_value(name)[source]
field_value_set(name, value)[source]
field_value_set_via_api(name, value, on_method)[source]
group_attr(field_or_dotted, group=None, attr=None)[source]
group_attr_set(dotted, value)[source]
is_field_value_valid(name, value)[source]
multi_field_value(fields)[source]
multi_group_attr_set(*args)[source]
rollback()[source]

slicops.device_db module

Accessing meta data about devices

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

exception slicops.device_db.DeviceDbError[source]

Bases: Exception

class slicops.device_db.DeviceMeta[source]

Bases: PKDict

Information about a device

accessor

name to PKDict(name, csi_name, writable, py_type, …)

Type:

PKDict

beam_area

area where device is located

Type:

str

beam_path

which beam paths does it go through

Type:

tuple

device_type

type device, e.g. “PROF”

Type:

str

device_name

name of device

Type:

str

csi_name

prefix to all accessors for device

Type:

str

slicops.device_db.beam_paths()[source]

Get all beam path names

Returns:

sorted beams path names

Return type:

tuple

slicops.device_db.device_names(device_type, beam_path)[source]

Query devices for device_type and beam_path

Parameters:
  • device_type (str) – type of device to filter by

  • beam_path (str) – which beam path

Returns:

sorted device names

Return type:

tuple

slicops.device_db.meta_for_device(device_name)[source]

Look up meta data for device_name

Parameters:

device_name (str) – which device

Returns:

information about device

Return type:

DeviceMeta

slicops.device_db.upstream_devices(device_type, accessor_name, beam_path, device_name)[source]

returns in z order

slicops.device_sql_db module

SQL db of lcls_tools.common.devices.yaml.

Use slicops.device_db for a stable interface.

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

slicops.device_sql_db.beam_paths()[source]
slicops.device_sql_db.device(name)[source]
slicops.device_sql_db.device_names(device_type, beam_path)[source]
slicops.device_sql_db.recreate(parser)[source]

Recreates db

slicops.device_sql_db.upstream_devices(device_type, required_accessor, beam_path, end_device)[source]

slicops.field module

Ctx Value

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.field.Base(prototype, overrides)[source]

Bases: object

as_dict()[source]
group_attr(group, attr=None)[source]
new(overrides)[source]
renew(overrides)[source]
value()[source]
value_check(value)[source]
value_set(value)[source]
class slicops.field.Boolean(prototype, overrides)[source]

Bases: Base

class slicops.field.Button(prototype, overrides)[source]

Bases: Base

class slicops.field.Dict(prototype, overrides)[source]

Bases: Base

class slicops.field.Enum(prototype, overrides)[source]

Bases: Base

class slicops.field.Float(prototype, overrides)[source]

Bases: Base

class slicops.field.Integer(prototype, overrides)[source]

Bases: Base

class slicops.field.InvalidFieldValue(msg, **kwargs)[source]

Bases: object

class slicops.field.List(prototype, overrides)[source]

Bases: Base

class slicops.field.String(prototype, overrides)[source]

Bases: Base

slicops.field.prototypes()[source]

slicops.mock_epics module

slicops.plot module

Plot functions

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.plot.ImageSet(meta)[source]

Bases: object

Fits images, possibly averaging.

Can take arbitrary meta data, e.g. pv and it will be written by save_file.

Parameters:

meta (PKDict) – images_to_average, camera, curve_fit_method, pv

add_frame(frame, timestamp)[source]

Add and update fit

Parameters:
  • frame (ndarray) – new image

  • timestamp (datetime) – time of frame

Returns:

frame and fit or None if not enough frames

Return type:

PKDict

save_file(dir_path)[source]
Creates a hdf5 file with the structure::
/image Group

/frames Dataset {images_to_average, ysize, xsize} /mean Dataset {ysize, xsize} /timestamps Dataset {images_to_average} /x Group

/fit Dataset {xsize} /profile Dataset {xsize}

/y Group

/fit Dataset {ysize} /profile Dataset {ysize}

/meta Group (camera, curve_fit_method, images_to_average, etc.)

Parameters:

dir_path (py.path) – directory

slicops.plot.fit_image(image, method)[source]

Attemp an analytical fit for the sum along the x and y dimensions

Uses scipy.optimize.curve_fit

Parameters:
  • image (ndarray) – 2-d matrix

  • method (str) – Either gaussian or super_gaussian

Returns:

raw_pixels, x & y={lineout: sum, fit: {fit_line, results: {sig, amp, mean, offset}}

Return type:

PKDict

slicops.quest module

Context for a web or command line operation (think: request object)

A quest is an instance of API and contains several attributes (Attr):

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.quest.API(*args, **kwargs)[source]

Bases: API

Superclass of quest entry points

class slicops.quest.Attr(qcall, **kwargs)[source]

Bases: Attr

Superclass of quest context objects

slicops.quest.attr_classes()[source]

Classes instantiated automatically on every start

Returns:

class objects

Return type:

tuple

slicops.quest.import_and_start()[source]

Import slicops.modules, initialize them, and call start

Returns:

instantiated coroutine

Return type:

asyncio.task

slicops.quest.register_attr(attr_class)[source]

Called by modules to add their classes to attr_classes

Parameters:

attr_class (class) – implements pykern.quets.Attr

slicops.quest.start()[source]

Calls pykern.quest.start with attr_classes

Returns:

instantiated coroutine

Return type:

asyncio.task

slicops.slicops_console module

Front-end command line for slicops.

See pykern.pkcli for how this module is used.

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

slicops.slicops_console.main()[source]

slicops.ui_api module

UI APIs

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.ui_api.API(*args, **kwargs)[source]

Bases: API

Implementation for the Screen (Profile Monitor) application

async api_ui_ctx_update(api_args)[source]
async api_ui_ctx_write(api_args)[source]
slicops.ui_api.api_classes()[source]

slicops.ui_layout module

Display layout

copyright:

Copyright (c) 2025 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.ui_layout.UILayout(rows, ctx)[source]

Bases: object

slicops.unit_util module

Support for unit tests

copyright:

Copyright (c) 2024 The Board of Trustees of the Leland Stanford Junior University, through SLAC National Accelerator Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All Rights Reserved.

license:

http://github.com/slaclab/slicops/LICENSE

class slicops.unit_util.SlicletSetup(sliclet, *args, **kwargs)[source]

Bases: Setup

async ctx_field_value_set(**kwargs)[source]
async ctx_update()[source]
async http_get(rel_uri)[source]
slicops.unit_util.random_epics_ports()[source]

Open the IOC

slicops.unit_util.setup_screen(beam_path, device_name)[source]
slicops.unit_util.start_ioc(init_yaml, db_yaml=None)[source]