Function Plugin API
Function plugins live in the config/transformations folder. PhysPlot loads
these files from disk, so their filenames may start with numbers for menu
ordering, but their public API should stay simple and predictable.
Required Module Variables
DISPLAY_NAME: strThe name shown in the mathematical transformation dropdown.
Required Function
- transform(values) numpy.ndarray
Transform one numeric column and return the transformed values.
- Parameters:
values (array-like) – One-dimensional numeric input values, usually a
numpy.ndarraycopied from the selected table column.- Returns:
One-dimensional numeric output values with the same row order as the input.
- Return type:
numpy.ndarray
Plugin Files Included with PhysPlot
File |
Display name |
Core behavior |
|---|---|---|
|
|
Returns the input values unchanged. |
|
|
Squares each value. |
|
|
Cubes each value. |
|
|
Returns the reciprocal of each value. |
|
|
Applies base-10 logarithm. |
|
|
Applies natural logarithm. |
|
|
Applies the exponential function. |
|
|
Applies cosine. |
|
|
Applies sine. |
|
|
Applies tangent. |
|
|
Applies inverse cosine. |
|
|
Applies inverse sine. |
|
|
Applies inverse tangent. |
|
|
Estimates and subtracts a smooth baseline from diffraction-style data. |
Implementation Notes
Each function file should import only what it needs. For most transformations,
numpy is enough. Avoid editing table widgets or figure-editor windows inside a
function plugin; PhysPlot handles reading the selected column, writing the
output column, and refreshing the plot.
Files with spaces in their names cannot be imported as normal Python modules.
Prefer filenames such as 15_my_function.py.
Transformation Resolution
Built-in transforms and config/transformations plugins are resolved by the
backend, so recorded plugin steps replay without the GUI.
Column transformations: registered built-ins plus config/transformations plugins.
Built-in transformations are registered in TRANSFORMS. Any other name is
resolved against the transformation plugin folders returned by
physplot.user_paths.plugin_search_dirs("transformations") (the editable
Documents/PhysPlot/config/transformations first, then the bundled
config/transformations). A plugin is a .py file defining
transform(values) and, optionally, DISPLAY_NAME. It is matched by file
stem ("02_square") first, then by DISPLAY_NAME ("x^2"), so a sequence
that records a plugin transformation replays headlessly with no GUI imports.
- discover_plugin_transforms() list[dict][source]
Return every usable plugin in the transformation folders.
Each entry has
name(the file stem, which is what sequences record),display_name,pathand the loadedmodule. A user file overrides a bundled file with the same name. Plugins that fail to import, lacktransform, or reuse a built-in transformation name are skipped with a message on stderr.