Files
muSRFlow/docs/source/configuration-sharing.rst
salman 184c5b9eb1 Add musrflow:// configuration links and musrfit thread preference
Register the musrflow:// URL scheme at startup (electron-builder writes the
matching MimeType=x-scheme-handler desktop entry for the packaged Linux
builds), accept musrflow://open/#c= links on the launch path and macOS
open-url alongside the existing http(s)/bare-fragment forms, and add a web
Share button that emits the identical encoded fragment under musrflow://open/
so a browser can hand a configuration to the installed desktop app.

Add a musrfit threads field to the Electron Preferences dialog. A set count
is passed to local fits as `musrfit -u <n>`; blank keeps the previous
all-cores behaviour and the web edition ignores it.

Document both features (preferences, runs/fitting, configuration sharing,
desktop deployment, CHANGELOG) and rebuild the Sphinx HTML and PDF.
2026-10-10 10:40:41 +02:00

82 lines
3.6 KiB
ReStructuredText

Configuration sharing
=====================
muSRFlow can encode the current analysis settings into a single link that
another instance can restore. This is useful for reproducing a session or for
passing a fit setup to a colleague.
What is shared
--------------
The link carries the run selection, instrument, year, fit range, model
components, fit options, parameters and constraints, plot/FFT/RRF view
settings, the analysis-related preferences, and -- when a parameter plot
configuration was remembered for the current data source -- the parameter-plot
window state (panel arrangement, palette, trace styles, overlay files). When
the sender's parameter data is available on the machine that produces the link
(a completed fit), the actual msr2data table is embedded as well, so the
recipient can draw the identical plot -- fitted values, scan variable, and error
bars -- without reproducing the sender's ``*_par.dat`` on its own file system.
It does **not** carry the raw data files or your local working directories. A restored
session therefore recreates the analysis on top of whatever data the target
machine can see.
On the web
----------
The share button in the tab bar (the chain-link icon) copies a link such as
.. code-block:: text
http://musruser.psi.ch/muSRFlow/#c=...
Anyone who opens the link in a browser gets the same analysis settings, as
long as the server exposes the same data.
A visitor who has the desktop build installed can also use the second button
next to the share button (the monitor icon). It copies the same payload as a
``musrflow://`` link instead:
.. code-block:: text
musrflow://open/#c=...
A browser cannot navigate to its own ``https`` page and then hand the payload
to an installed application, so this dedicated scheme lets the web page open
the settings directly in the desktop app. Only the base URL differs; the
encoded fragment is byte-for-byte the same, so either link restores the same
analysis.
On the desktop
--------------
Electron cannot handle its own browser links, so it ships the same encoding
backwards as well: open a muSRFlow configuration link (from the web or from a
colleague) and choose **Restore configuration link** to paste it into the
restore dialog. The analysis settings are applied while your local data and
working directories remain untouched.
The installed application also registers the ``musrflow://`` scheme, so
clicking such a link (in a mail client, a document, or the web page above)
starts muSRFlow and restores the embedded settings directly. The canonical
``http://musruser.psi.ch/muSRFlow/#c=...`` link still works: paste it into the
restore dialog. See the desktop deployment notes for how the scheme is
installed, including the AppImage caveat.
Notes
-----
* The shared payload is a compact, optionally compressed fragment in the URL
hash; nothing is sent to a third party.
* A restored configuration may reference data that was never fit on the
target machine. The parameter table is rebuilt from the restored settings
and can be populated by running a fit.
* The parameter-plot stanza is optional and keyed by the data source's
identity. When the sender's parameter table could be read at share time it is
carried inline as the main source, so on the web the plot opens immediately
after restore (the browser's ``Plot parameters...`` action applies it the
first time it is used). Otherwise it is applied when the same source exists
on the target machine -- a matching on-disk parameter-data path or an
identical inline parameter table (see
:ref:`Remembered plot configurations`). If neither applies it is ignored
harmlessly and the plot opens with the normal dialog.