tofscope 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. tofscope-0.1.0/LICENSE +21 -0
  2. tofscope-0.1.0/MANIFEST.in +6 -0
  3. tofscope-0.1.0/PKG-INFO +14 -0
  4. tofscope-0.1.0/README.md +81 -0
  5. tofscope-0.1.0/pyproject.toml +28 -0
  6. tofscope-0.1.0/setup.cfg +4 -0
  7. tofscope-0.1.0/setup.py +20 -0
  8. tofscope-0.1.0/src/tofscope/__init__.py +1 -0
  9. tofscope-0.1.0/src/tofscope/api/__init__.py +0 -0
  10. tofscope-0.1.0/src/tofscope/api/app.py +549 -0
  11. tofscope-0.1.0/src/tofscope/api/auth.py +82 -0
  12. tofscope-0.1.0/src/tofscope/api/schemas.py +91 -0
  13. tofscope-0.1.0/src/tofscope/application/__init__.py +0 -0
  14. tofscope-0.1.0/src/tofscope/application/analyses.py +237 -0
  15. tofscope-0.1.0/src/tofscope/application/cache.py +166 -0
  16. tofscope-0.1.0/src/tofscope/application/commands.py +153 -0
  17. tofscope-0.1.0/src/tofscope/application/explore.py +161 -0
  18. tofscope-0.1.0/src/tofscope/application/identification.py +153 -0
  19. tofscope-0.1.0/src/tofscope/application/identification_models.py +75 -0
  20. tofscope-0.1.0/src/tofscope/application/jobs.py +347 -0
  21. tofscope-0.1.0/src/tofscope/application/lifecycle.py +80 -0
  22. tofscope-0.1.0/src/tofscope/application/models.py +74 -0
  23. tofscope-0.1.0/src/tofscope/application/preparations.py +46 -0
  24. tofscope-0.1.0/src/tofscope/application/resources.py +63 -0
  25. tofscope-0.1.0/src/tofscope/application/saves.py +76 -0
  26. tofscope-0.1.0/src/tofscope/application/signals.py +74 -0
  27. tofscope-0.1.0/src/tofscope/application/spatial.py +78 -0
  28. tofscope-0.1.0/src/tofscope/cli.py +157 -0
  29. tofscope-0.1.0/src/tofscope/config.py +139 -0
  30. tofscope-0.1.0/src/tofscope/presentation/__init__.py +0 -0
  31. tofscope-0.1.0/src/tofscope/presentation/coordinates.py +31 -0
  32. tofscope-0.1.0/src/tofscope/presentation/data.py +54 -0
  33. tofscope-0.1.0/src/tofscope/presentation/explore.py +267 -0
  34. tofscope-0.1.0/src/tofscope/presentation/exports.py +102 -0
  35. tofscope-0.1.0/src/tofscope/presentation/isotopes.py +31 -0
  36. tofscope-0.1.0/src/tofscope/presentation/volumes.py +210 -0
  37. tofscope-0.1.0/src/tofscope/resources/__init__.py +0 -0
  38. tofscope-0.1.0/src/tofscope/resources/reference/README.md +36 -0
  39. tofscope-0.1.0/src/tofscope/resources/reference/isotopes.json +36901 -0
  40. tofscope-0.1.0/src/tofscope/science/__init__.py +0 -0
  41. tofscope-0.1.0/src/tofscope/science/abundance.py +42 -0
  42. tofscope-0.1.0/src/tofscope/science/depth_calibration.py +73 -0
  43. tofscope-0.1.0/src/tofscope/science/integration.py +149 -0
  44. tofscope-0.1.0/src/tofscope/science/isotopes.py +90 -0
  45. tofscope-0.1.0/src/tofscope/science/raw_peaks.py +50 -0
  46. tofscope-0.1.0/src/tofscope/science/signals.py +114 -0
  47. tofscope-0.1.0/src/tofscope/science/volume_layers.py +112 -0
  48. tofscope-0.1.0/src/tofscope/static/assets/VtkScene-q-o3MPFv.js +5774 -0
  49. tofscope-0.1.0/src/tofscope/static/assets/datasophos-wordmark.png +0 -0
  50. tofscope-0.1.0/src/tofscope/static/assets/favicon.svg +5 -0
  51. tofscope-0.1.0/src/tofscope/static/assets/index-CeV0NVRS.css +1 -0
  52. tofscope-0.1.0/src/tofscope/static/assets/index-djLJCKw_.js +24 -0
  53. tofscope-0.1.0/src/tofscope/static/index.html +14 -0
  54. tofscope-0.1.0/src/tofscope/static/licenses/matplotlib.txt +99 -0
  55. tofscope-0.1.0/src/tofscope/static/manifest.json +13 -0
  56. tofscope-0.1.0/src/tofscope/storage/__init__.py +0 -0
  57. tofscope-0.1.0/src/tofscope/storage/acquisitions.py +281 -0
  58. tofscope-0.1.0/src/tofscope/storage/analysis_document.py +210 -0
  59. tofscope-0.1.0/src/tofscope/storage/bounded_events.py +167 -0
  60. tofscope-0.1.0/src/tofscope/storage/compact_copy.py +143 -0
  61. tofscope-0.1.0/src/tofscope/storage/dataset_io.py +166 -0
  62. tofscope-0.1.0/src/tofscope/storage/explorer.py +201 -0
  63. tofscope-0.1.0/src/tofscope/storage/file_browser.py +41 -0
  64. tofscope-0.1.0/src/tofscope/storage/identification_document.py +47 -0
  65. tofscope-0.1.0/src/tofscope/storage/integration_store.py +140 -0
  66. tofscope-0.1.0/src/tofscope/storage/native_saved_copy.py +252 -0
  67. tofscope-0.1.0/src/tofscope/storage/raw_preparation.py +195 -0
  68. tofscope-0.1.0/src/tofscope/storage/saved_files.py +331 -0
  69. tofscope-0.1.0/src/tofscope/storage/vendor_export.py +114 -0
  70. tofscope-0.1.0/src/tofscope.egg-info/PKG-INFO +14 -0
  71. tofscope-0.1.0/src/tofscope.egg-info/SOURCES.txt +73 -0
  72. tofscope-0.1.0/src/tofscope.egg-info/dependency_links.txt +1 -0
  73. tofscope-0.1.0/src/tofscope.egg-info/entry_points.txt +2 -0
  74. tofscope-0.1.0/src/tofscope.egg-info/requires.txt +6 -0
  75. tofscope-0.1.0/src/tofscope.egg-info/top_level.txt +1 -0
tofscope-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Josh Taillon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ recursive-include src/tofscope/static *
2
+ recursive-include src/tofscope/resources/reference *
3
+ include README.md pyproject.toml setup.py
4
+ prune frontend
5
+ prune tests
6
+ prune docs
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: tofscope
3
+ Version: 0.1.0
4
+ Summary: Multi-analysis ToF-SIMS exploration and calibrated 3D visualization
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.11
7
+ License-File: LICENSE
8
+ Requires-Dist: h5py>=3.11
9
+ Requires-Dist: numpy>=2.0
10
+ Requires-Dist: filelock>=3.16
11
+ Requires-Dist: fastapi>=0.115
12
+ Requires-Dist: uvicorn>=0.30
13
+ Requires-Dist: psutil>=6
14
+ Dynamic: license-file
@@ -0,0 +1,81 @@
1
+ <p align="center">
2
+ <img src="docs/assets/tofscope-logo.svg" alt="ToFScope — FIB–SEM / TOF–SIMS" width="324">
3
+ </p>
4
+
5
+ # ToFScope
6
+
7
+ ToFScope is a browser-based application for exploring time-of-flight secondary ion mass spectrometry (ToF-SIMS) data. It allows you to analyze ion images, mass spectra, and depth profiles together so you can inspect an acquisition, compare signals, and save your analysis for later.
8
+
9
+ ToFScope runs locally as a Python application and opens in your browser. It reads [TOFWERK TOFexplorer](#trademark-disclaimer) HDF5 (`.h5`) acquisitions, and provides interactive tools for exploring their mass spectra, ion images, and depth profiles in two and three dimensions.
10
+
11
+ ![ToFScope Explore showing an ion map, mass spectrum, front projection, and depth profile from a real acquisition](docs/assets/tofscope-explore.png)
12
+
13
+ *Explore view showing an ion map, mass spectrum, front projection, and depth profile for a real acquisition.*
14
+
15
+ ## What you can do
16
+
17
+ - **Explore an acquisition:** view ion maps, a mass spectrum, front projections, and depth profiles together; choose custom regions of interest and frame range.
18
+ - **Compare signals:** use stored ion channels or define custom mass windows from the spectrum, then compare their profiles.
19
+ - **Work with depth:** add calibration anchors to display profiles and projections in physical depth where calibration is known.
20
+ - **Inspect peaks and isotopes:** find candidate atomic isotope ions and measure selected signals over a region and frame range.
21
+ - **Visualize in 3D:** compare signals as volume overlays or tiled views, with controls for color, opacity, and threshold.
22
+ - **Keep and share results:** export profiles as CSV or plots as PNG, and save data back into TOFexplorer-compatible `.h5` files.
23
+
24
+ ![ToFScope 3D visualizer showing an overlay of aluminum and titanium signals](docs/assets/tofscope-3d.png)
25
+
26
+ *3D volume view comparing aluminum and titanium signals across acquisition frames.*
27
+
28
+ ![Atomic identification dialog showing an aluminum-27 isotope candidate and mass spectrum](docs/assets/tofscope-isotope-identification.png)
29
+
30
+ *Atomic identification compares a measured mass-to-charge ratio with candidate isotope ions.*
31
+
32
+ ## Get started
33
+
34
+ You need Python 3.11 or newer, [uv](https://docs.astral.sh/uv/getting-started/installation/), and a folder containing supported TOFexplorer `.h5` files. From a clone of this repository:
35
+
36
+ ```sh
37
+ uv tool install .
38
+ tofscope --data-root /path/to/acquisitions --output-root /path/to/saved-analyses
39
+ ```
40
+
41
+ Replace the example paths with your folders. The output folder must be writable and have enough space for a full copy of an acquisition. ToFScope starts a local service and opens the app in your browser. Select a file to begin; keep the terminal open while you work and press **Ctrl-C** there to stop the app.
42
+
43
+ For a step-by-step installation, including folder setup and troubleshooting, see the [macOS setup guide](docs/macos-tofscope.md). For configuration, hosted use, and containers, see [deployment](docs/deployment.md).
44
+
45
+ ## Your first analysis
46
+
47
+ 1. Open an acquisition and choose a stored signal, or create one from a mass window in the spectrum.
48
+ 2. Select a frame range and region of interest to explore its ion image and depth profile. Add other signals to compare profiles.
49
+ 3. Use **Depth calibration…** if you have known frame-to-depth measurements, or open **3D volume** to explore the signal spatially.
50
+ 4. Choose **Save as…** to save a new analysis copy. After a restart, open it through **Saved files** to resume your saved work.
51
+
52
+ Saving leaves the source acquisition unchanged. Unsaved tabs and in-progress calculations do not survive a restart. Some raw files require preparation into a new copy before exploration; ToFScope previews that step and asks for confirmation.
53
+
54
+ The [user guide](docs/user-guide.md) covers signals, calibration, exports, isotope identification, saving, and 3D controls in more detail.
55
+
56
+ ## Current limitations
57
+
58
+ ToFScope is under active development and is in an alpha state. The application may change substantially prior to a stable 1.0.0 release.
59
+ See the [user guide](docs/user-guide.md) and [project roadmap](TODO.md) for details.
60
+ If you have ideas of features to add, or notice any bugs, please open an [issue](https://github.com/datasophos/ToFScope/issues)!
61
+
62
+ ## Developing ToFScope
63
+
64
+ The frontend is built with React and TypeScript; the service backend uses Python and FastAPI. Node.js is needed to develop or rebuild the frontend, but not to run the packaged application. From a source checkout:
65
+
66
+ ```sh
67
+ uv sync --frozen
68
+ uv run tofscope --data-root /path/to/acquisitions --output-root /path/to/saved-analyses
69
+ ```
70
+
71
+ For frontend and Python checks, build instructions, and distribution validation, see the [developer commands](docs/user-guide.md#building-and-testing). Scientific and implementation evidence is available in [docs/validation](docs/validation/).
72
+
73
+ ## License
74
+
75
+ ToFScope is available under the [MIT License](LICENSE).
76
+
77
+ ---
78
+
79
+ ### Trademark disclaimer
80
+
81
+ TOFWERK and TOFexplorer are names owned by [TOFWERK AG](https://www.tofwerk.com/). They are used here solely to identify the products and file formats supported by ToFScope. ToFScope is an independent project and is not affiliated with, endorsed by, or sponsored by TOFWERK AG.
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=75"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tofscope"
7
+ version = "0.1.0"
8
+ description = "Multi-analysis ToF-SIMS exploration and calibrated 3D visualization"
9
+ requires-python = ">=3.11"
10
+ license = "MIT"
11
+ dependencies = ["h5py>=3.11", "numpy>=2.0", "filelock>=3.16", "fastapi>=0.115", "uvicorn>=0.30", "psutil>=6"]
12
+
13
+ [project.scripts]
14
+ tofscope = "tofscope.cli:main"
15
+
16
+ [dependency-groups]
17
+ dev = [
18
+ "httpx>=0.27",
19
+ "build>=1.2",
20
+ "playwright>=1.50",
21
+ "rosettasciio==0.15.0",
22
+ ]
23
+
24
+ [tool.setuptools.packages.find]
25
+ where = ["src"]
26
+
27
+ [tool.setuptools.package-data]
28
+ tofscope = ["static/**/*", "static/*", "resources/reference/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,20 @@
1
+ """Validate prebuilt assets for both source-checkout and sdist installations."""
2
+ from setuptools import setup
3
+ from setuptools.command.build_py import build_py
4
+ from pathlib import Path
5
+ import hashlib
6
+ import json
7
+ import runpy
8
+ class CheckedBuild(build_py):
9
+ def run(self):
10
+ root=Path(__file__).parent;static=root/'src/tofscope/static';manifest=static/'manifest.json'
11
+ if not manifest.exists():raise RuntimeError('Missing bundled frontend. Run scripts/build_frontend.py before building artifacts.')
12
+ m=json.loads(manifest.read_text())
13
+ for name,digest in m['assets'].items():
14
+ if hashlib.sha256((static/name).read_bytes()).hexdigest()!=digest:raise RuntimeError('Bundled asset integrity mismatch.')
15
+ if (root/'frontend/src').exists():
16
+ # This source check is omitted in an sdist, which contains only verified assets.
17
+ module=runpy.run_path(str(root/'scripts/build_frontend.py'))
18
+ if module['source_hash']()!=m['source_sha256']:raise RuntimeError('Stale frontend assets. Run scripts/build_frontend.py.')
19
+ super().run()
20
+ setup(cmdclass={'build_py':CheckedBuild})
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
File without changes