|
Dispense
Navigation
Tips - Dritte
PmWiki
pmwiki.org
edit SideBar
|
< Mujpy.JupiterlabSettings | Index | Mujpy.JupyterTricks >
- wip
- fix FFT and RRF (possibly MESA, i.e. memspectrum)
- define strategy for histo inspection
- tests for real ISIS datasets
- sort folders: handle mkdir from mujpy? in an ipyw extension? A possible path policy:
- suggest to start always from ~/mujpy and store this as self.rootpath in mudahed
- copy groups there and initiate a self.grouppath in mudashed
- check that both pathlib objects and string paths (in widgets) are recognised
- a mkdir button navigates to/generates a project subfolders cascade (eg sample/instrument/run/wtf) in mudashed and cd to the last subfolder
- getcwd records this as startuppath and passes it to suite
- so suite generates or detects data, fit, cache, ... folders in self.startuppath
- create mudashed ipynb and run it: insert the core idea below as a method in testsm .
import os
import nbformat as nbf
# insert into class ParameterizedRunner()
def test_dashed_notebook_generation(self):
"""Generate a Jupyter Notebook (.ipynb) to test the dashed interface."""
nb = nbf.v4.new_notebook()
# Cell 1: Activate QT backend for Matplotlib
code_cell_1 = "%matplotlib qt"
# Cell 2: Import and instantiate dashboard
code_cell_2 = (
"from mujpy.mudashed import dashed\n"
"dashed(test='gui')"
)
nb['cells'] = [
nbf.v4.new_code_cell(code_cell_1),
nbf.v4.new_code_cell(code_cell_2)
]
self.notebook_filename = 'Mudashed_demos.ipynb'
with open(self.notebook_filename, 'w', encoding='utf-8') as f:
nbf.write(nb, f)
# Verify that file exists
self.assertTrue(os.path.exists(self.notebook_filename))
- is this needed? It requires a
python -m mujpy/tests/mujpy_nb.py or python -c "from mujpy.tests.tests import ParameterisedRunner as PR; rnr=PR(), rnr.write_ipynb()" && jupyter notebook Mudashed_demos.ipynb instead of witing three lines in two nb cells
python -m mujpy.tests.tests test 11 has one Minuit did not converge triggering runtime warning. Make a dialog for Minuit did not converge and trap the np warning with e.g. with np.errstate(over="ignore",divide="ignore",invalid="ignore"): ... return chi2 in the assumption that in any case Minuit will not converge. Then enhance Minuit did not converge message with a dialog
- win only overflow when fitting 822,834 with almgml:
overflow encountered in square normsquaredev = (num/self._e_)**2 , twice
overflow encountered in exp return A*cos(2*pi*self._gamma_Mu_MHzper_mT*B*x+φ*self._radeg_)*exp(-x*λ) , also im multipy
In itself not dangerous, handled by iminuit, see above
- try installing directly in windows. Install again python3.14 (includes pip and venv), do not install git, make a windows venv, activate and run python -m pip install --upgrade in it. Then run just jupyter lab.
- create a dowload button in the gui that offers a tick palette of folder to include, cache, fit, csv, data, ...
- offers tickbox selection of content cache fit csv, chat suggests
import base64
import html
from pathlib import Path
import ipywidgets as widgets
def download_link(filename):
path = Path(filename)
data = base64.b64encode(path.read_bytes()).decode("ascii")
name = html.escape(path.name, quote=True)
return widgets.HTML(
value=(
f'<a href="data:application/octet-stream;base64,{data}" '
f'download="{name}">Download {name}</a>'
)
)
- and
display(download_link("fit_results.json")) while in mudashed self.download_box = widgets.HTML() include in the gui as self.download_box.value = download_link(filename).value (conceptually the url is https://your-server/<session-prefix>/voila/files/downloads/)results.zip
- Mudashed writes results.zip into a designated server folder, say downloads/.
- displays a link to that file.
- clicking it downloads the file to the user’s computer through their browser.
- test on recent gps MuSRRoot format,. different! see [[
- create fit templates with mudashed and test them, save to tests/fit_templates/ and instruct ReadThedocs to let user download them or mudashes to upload them to fit_?
- fetch data uploads to root if data has not been created, do.
- OSError: file '/mnt/c/Users/derob08/win-mujpy/MBT124/data/lem24_his_3561.root' is closed on wsl does not read root any more. Have been reading on linux before, and muroot2py was not touched ?!?!
- from end August 2026
- 6/10/26 committed a version, tested on dell wsl works. fixed editor switching bugs, now the editor works in all tested instances. Can start from scratch all fits, delete global parameters, delete add one model component at a time, switch from sequential to global and viceversa. ✅
- raasonably ** complete documentation **
- debugged wsl win version, using Jupyterlab 7 with subshells, coming soon to linux see jupyterlab.Settings?. Breaks Qt, ealt by QtDispatcher class in tools, mudashed has distinct drawing calls for Qt and ipympl. ✅
- made dialog render multiline '\n' messages ✅
- solved other small bugs, v3.1.4
- published v3.1 on PyPI, see PackageMaintenance ✅
- substituted all tk dialogs with Gemini co-brewed ipyw_path_file_dial+ ValueButton+Dialog tab ✅
- employs display toggling between 'flex' and 'none' to emulate (functionally) popup and single click selection for fastest turnout ✅
- new tests, updated Installation, Tutorial e README ✅
- json very weak against manual manipulation! mudashed checks syntax is right comparing to small list of allowed keys.✅ Does not check their values or the global model feasibility. ❌
- Global model logic checks that: ✅
- all model parameter flags are "=",
- all indices k <= len(globpardicts) are referenced in model functions,
- models with hashes in globpardicts flags and len(groupings)>1 have at least one ";" in model function texts (is this right?)
- if _C1() & len(self.grouping)>1 or suite.nruns==1 raises not a C1
- if _C2() & len(self.grouping)>1 and suite.nruns==1 raises not a C2
- if _AB21 and len(suite.goruping==1)/_ raises not A21 or B21
- data fit and groups by importlib.resources ✅
- remove sidecar ✅
- use font Inter< guaranteed uniform across os'es, must load it and invoke in a css (see css_widget)✅
- fixed _add_del_plot .unobserve and .observe with self._pardicts_observer to pass the index kp ✅
- update command_box, modify an already edited model, add a drop-down to each global parameter widget list with delete/insert/subplot axis, and following modify acronym, ✅
- when model is already displayed, if new acronym adds a component, append an empty one; if it removes one, pop it; for more complex moves offer to start afresh.
- if complex, return empty component and 0, then confirm that the new model will be started afresh, otherwise abort, so return
- if add return component to add and position, then obtain the old model list, insert the component in that position with empty parameters and rebuild the dash
- if remove return component to remove and negative of position, then obtain the old model lists, pop the component and rebuild the dash
- suite_box: extend list and groups after first use works fine, popup must press RL, obnoxious, removed ❌
- tk_error obeys geometry at all calls (tk_error and file_dialog). Important: always add the kwarg root=self.root from mudashed! ✅
- checks coherence of global fits with groups and run list, issues warnings by tk_error, ✅
- fix sphinx-ext-autodoc, update Source (mostly checked) ✅
- made mudashed more pythonic: observe and on_click callbacks become private methods
_on_xx(self,change):
- tag v3.1 on 8 September 26 ✅
- local
pip install . works ✅
- standard groups in mudashed by LG load, ✅
- all messages by tkinter pop up at +400+10 [px] on the screen done, ✅
- tabs: help with function list and initial suggestions, log (comes to focus after fit, substitutes sidecar, mudashed(self,...,sidecar=False) ), about with logo ✅
- renew tests for mudashed(test=None,'gps','lem', 'musr'), ✅
- direct access to PSI data (|vpn + proxy + script), ISIS data, ✅
- from May 2026
- v 3.0 ReadTheDocs build after every new version. ✅
- more sensible versioning, see https://packaging.python.org/en/latest/tutorials/packaging-projects/, ✅
- uses
git describe, relies on git tag -a vN.M before git commit -m "description", now works ✅
- set up voila for standalone use (does not need jupiterlab)✅
- use
%matplotlib qt for pop up figure window ✅
- add sidecar to mudashed and direct log to second jupyterlab tab to the right, ❌ removed after putting log in Log tab ✅
- finalize muroot2py in musuite, with one further stantalone test (almg.3561. ... .py) ✅
- remove deprecated methods ✅
- create new mudashed.py class for the GUI
- create test.py and its individual 16 tests, run by hand ...
- upgrade mufitplot to use consistently mucomponents methods for slicing musuite
- mufit uses only in two flavours: sequential (A1, A20, B1, B20) and global (A21, B21, C1, C2). Hash flag to identify the latter two.
- insert slice in musuite to construct asymmetry slices
- standardize
mufit using explicitly self.A1() ... self.C2_calib() identification
- only
dofit_ and dofit_calib_ in the end
- general
execute_log_save_fit
mucomponents stores suite instance
- only
_load_ and _load_calib_ methods switchyards
_reload_ and _reload_calib_ to redefine ranges for plotting purposes
- sequential fits also need reloading
asymm and asyme for different groups/runs: _asymmetry_single calculates asymmetry on a slice and _asymmetry_multirun_multigroup either passes it on (1d) or vstacks a 2d/3d array. This must be selectable from mufit to handle sequential fits in execute_log_save_fit
- lacking an automated mechanism
mufit uses a mucomponents method to set the slice indices for _asymmetry_multirun_multigroup?
- from Jan 2025 towards version 3.0.0
- created muroot2py, based on uproot, mimicking basic methods of MuSR_td_PSI_bin.cpp
- created muisis2py anew, based on nexusformat.nexus, mimicking MuSR_td_PSI_bin.cpp
- redesigned musuite.single_multigroup_for_back_counts which is the building block of asymmetry generation
- fixed several bugs
- tested fits A1, A20, A1_calib, A20_calib, A21_calib
< Mujpy.JupiterlabSettings | Index | Mujpy.JupyterTricks >
|