NSFopen 2.2.4__tar.gz → 2.4.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 (108) hide show
  1. nsfopen-2.4.0/CHANGELOG.md +141 -0
  2. nsfopen-2.4.0/MANIFEST.in +1 -0
  3. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/__init__.py +1 -1
  4. nsfopen-2.4.0/NSFopen/_version.py +1 -0
  5. nsfopen-2.4.0/NSFopen/example/Calculate_Roughness/Calculate_Roughness.html +7786 -0
  6. nsfopen-2.4.0/NSFopen/example/Calculate_Roughness/Calculate_Roughness.ipynb +258 -0
  7. nsfopen-2.4.0/NSFopen/example/Calculate_Roughness/Calculate_Roughness.py +91 -0
  8. nsfopen-2.4.0/NSFopen/example/Force_Spectroscopy/Contact_Models.py +48 -0
  9. nsfopen-2.4.0/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.html +7803 -0
  10. nsfopen-2.4.0/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.ipynb +271 -0
  11. nsfopen-2.4.0/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.py +160 -0
  12. nsfopen-2.4.0/NSFopen/example/Grain_Analysis/Grain_Analysis.html +7695 -0
  13. nsfopen-2.4.0/NSFopen/example/Grain_Analysis/Grain_Analysis.ipynb +178 -0
  14. nsfopen-2.4.0/NSFopen/example/Grain_Analysis/Grain_Analysis.py +70 -0
  15. nsfopen-2.4.0/NSFopen/example/Lateral_Force/Lateral_Force_Processing.html +7712 -0
  16. nsfopen-2.4.0/NSFopen/example/Lateral_Force/Lateral_Force_Processing.ipynb +184 -0
  17. nsfopen-2.4.0/NSFopen/example/Lateral_Force/Lateral_Force_Processing.py +69 -0
  18. nsfopen-2.4.0/NSFopen/example/Plane_Removal/Plane_Removal.html +7614 -0
  19. nsfopen-2.4.0/NSFopen/example/Plane_Removal/Plane_Removal.ipynb +106 -0
  20. nsfopen-2.4.0/NSFopen/example/Plane_Removal/Plane_Removal.py +44 -0
  21. nsfopen-2.4.0/NSFopen/example/Plotting_Data/Plotting_Data.html +7809 -0
  22. nsfopen-2.4.0/NSFopen/example/Plotting_Data/Plotting_Data.ipynb +278 -0
  23. nsfopen-2.4.0/NSFopen/example/Plotting_Data/Plotting_Data.py +101 -0
  24. nsfopen-2.4.0/NSFopen/example/Sharpen_Image/Sharpen_Image.html +7667 -0
  25. nsfopen-2.4.0/NSFopen/example/Sharpen_Image/Sharpen_Image.ipynb +154 -0
  26. nsfopen-2.4.0/NSFopen/example/Sharpen_Image/Sharpen_Image.py +71 -0
  27. nsfopen-2.4.0/NSFopen/example/Spring_Constant/Spring_Constant.html +7733 -0
  28. nsfopen-2.4.0/NSFopen/example/Spring_Constant/Spring_Constant.ipynb +201 -0
  29. nsfopen-2.4.0/NSFopen/example/Spring_Constant/Spring_Constant.py +92 -0
  30. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Spring_Constant/sader.py +8 -4
  31. nsfopen-2.4.0/NSFopen/process/__init__.py +9 -0
  32. nsfopen-2.4.0/NSFopen/process/colormaps.py +244 -0
  33. nsfopen-2.4.0/NSFopen/process/combine.py +112 -0
  34. nsfopen-2.4.0/NSFopen/process/contact.py +387 -0
  35. nsfopen-2.4.0/NSFopen/process/fitting.py +211 -0
  36. nsfopen-2.4.0/NSFopen/process/grains.py +316 -0
  37. nsfopen-2.4.0/NSFopen/process/iv.py +175 -0
  38. nsfopen-2.4.0/NSFopen/process/measure.py +862 -0
  39. nsfopen-2.4.0/NSFopen/process/ops.py +1278 -0
  40. nsfopen-2.4.0/NSFopen/process/process.py +1205 -0
  41. nsfopen-2.4.0/NSFopen/process/profile_iso.py +232 -0
  42. nsfopen-2.4.0/NSFopen/process/psdfit.py +215 -0
  43. nsfopen-2.4.0/NSFopen/process/spectroscopy.py +1005 -0
  44. nsfopen-2.4.0/NSFopen/process/surface3d.py +495 -0
  45. nsfopen-2.4.0/NSFopen/read/__init__.py +10 -0
  46. nsfopen-2.4.0/NSFopen/read/nhf.py +687 -0
  47. nsfopen-2.4.0/NSFopen/read/nhf_spec.py +27 -0
  48. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/read/read.py +189 -182
  49. nsfopen-2.4.0/NSFopen.egg-info/PKG-INFO +204 -0
  50. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/SOURCES.txt +30 -11
  51. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/requires.txt +1 -1
  52. nsfopen-2.4.0/PKG-INFO +204 -0
  53. nsfopen-2.4.0/README.md +175 -0
  54. {nsfopen-2.2.4 → nsfopen-2.4.0}/setup.py +68 -60
  55. nsfopen-2.4.0/tests/test_examples.py +26 -0
  56. nsfopen-2.4.0/tests/test_nsfopen.py +711 -0
  57. nsfopen-2.2.4/NSFopen/_version.py +0 -1
  58. nsfopen-2.2.4/NSFopen/example/Calculate_Roughness/Calculate_Roughness.html +0 -14844
  59. nsfopen-2.2.4/NSFopen/example/Calculate_Roughness/Calculate_Roughness.ipynb +0 -182
  60. nsfopen-2.2.4/NSFopen/example/Calculate_Roughness/Calculate_Roughness.py +0 -110
  61. nsfopen-2.2.4/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.html +0 -14913
  62. nsfopen-2.2.4/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.ipynb +0 -266
  63. nsfopen-2.2.4/NSFopen/example/Force_Spectroscopy/Force_Spectroscopy.py +0 -206
  64. nsfopen-2.2.4/NSFopen/example/Lateral_Force/Lateral Force Processing.html +0 -14808
  65. nsfopen-2.2.4/NSFopen/example/Lateral_Force/Lateral Force Processing.ipynb +0 -154
  66. nsfopen-2.2.4/NSFopen/example/Lateral_Force/Lateral Force Processing.py +0 -86
  67. nsfopen-2.2.4/NSFopen/example/Plane_Removal/Plane_Removal.html +0 -14971
  68. nsfopen-2.2.4/NSFopen/example/Plane_Removal/Plane_Removal.ipynb +0 -285
  69. nsfopen-2.2.4/NSFopen/example/Plane_Removal/Plane_Removal.py +0 -172
  70. nsfopen-2.2.4/NSFopen/example/Plotting_Data/Plotting Data.html +0 -14891
  71. nsfopen-2.2.4/NSFopen/example/Plotting_Data/Plotting Data.ipynb +0 -200
  72. nsfopen-2.2.4/NSFopen/example/Plotting_Data/Plotting Data.py +0 -112
  73. nsfopen-2.2.4/NSFopen/example/Sharpen_Image/Sharpen Image.html +0 -15001
  74. nsfopen-2.2.4/NSFopen/example/Sharpen_Image/Sharpen Image.ipynb +0 -318
  75. nsfopen-2.2.4/NSFopen/example/Sharpen_Image/Sharpen Image.py +0 -199
  76. nsfopen-2.2.4/NSFopen/example/Sharpen_Image/img.jpg +0 -0
  77. nsfopen-2.2.4/NSFopen/example/Spring_Constant/Spring_Constant.html +0 -14830
  78. nsfopen-2.2.4/NSFopen/example/Spring_Constant/Spring_Constant.ipynb +0 -191
  79. nsfopen-2.2.4/NSFopen/example/Spring_Constant/Spring_Constant.py +0 -91
  80. nsfopen-2.2.4/NSFopen/process/__init__.py +0 -9
  81. nsfopen-2.2.4/NSFopen/process/colormaps.py +0 -71
  82. nsfopen-2.2.4/NSFopen/process/process.py +0 -492
  83. nsfopen-2.2.4/NSFopen/read/__init__.py +0 -8
  84. nsfopen-2.2.4/NSFopen/read/read_beta.py +0 -658
  85. nsfopen-2.2.4/NSFopen.egg-info/PKG-INFO +0 -47
  86. nsfopen-2.2.4/PKG-INFO +0 -47
  87. nsfopen-2.2.4/README.md +0 -28
  88. {nsfopen-2.2.4 → nsfopen-2.4.0}/LICENSE +0 -0
  89. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Calculate_Roughness/__pycache__/Calculate_Roughness.cpython-310.pyc +0 -0
  90. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Calculate_Roughness/sapphire.nid +0 -0
  91. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Force_Spectroscopy/spectroscopy.nid +0 -0
  92. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Lateral_Force/SBS-PMMA.nid +0 -0
  93. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Plane_Removal/circles.nid +0 -0
  94. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Plane_Removal/circles_holes.nid +0 -0
  95. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Plane_Removal/grid.nid +0 -0
  96. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Plane_Removal/squares_holes.nid +0 -0
  97. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Plotting_Data/MoS2.nid +0 -0
  98. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Sharpen_Image/grid.nid +0 -0
  99. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Spring_Constant/__pycache__/Spring_Constant.cpython-310.pyc +0 -0
  100. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Spring_Constant/__pycache__/__init__.cpython-310.pyc +0 -0
  101. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Spring_Constant/thermal.nid +0 -0
  102. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen/example/Spring_Constant/thermal.png +0 -0
  103. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/dependency_links.txt +0 -0
  104. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/entry_points.txt +0 -0
  105. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/not-zip-safe +0 -0
  106. {nsfopen-2.2.4 → nsfopen-2.4.0}/NSFopen.egg-info/top_level.txt +0 -0
  107. {nsfopen-2.2.4 → nsfopen-2.4.0}/pyproject.toml +0 -0
  108. {nsfopen-2.2.4 → nsfopen-2.4.0}/setup.cfg +0 -0
@@ -0,0 +1,141 @@
1
+ # Change log
2
+
3
+ ## 2.4.0 (not yet released)
4
+
5
+ Compared to **2.3.0**.
6
+
7
+ ### Force spectroscopy analysis
8
+ Added, in `NSFopen.process` (the calculations of the Spectroscopy page of NSSA, the NSF Surface and Spectroscopy
9
+ Analyzer, so a script and the program give the same numbers):
10
+ - `contact`: elastic contact of a tip pressed into a flat sample. Models Hertz, Sneddon (exact), DMT, JKR and
11
+ Oliver-Pharr; tip shapes sphere, cone, four-sided pyramid, flat cylinder punch and hyperboloid. `fit_elastic`,
12
+ `fit_jkr`, `fit_oliver_pharr` give the Young's modulus, reduced modulus, contact point, adhesion and the fit quality.
13
+ - `spectroscopy`: `SpecFile` opens the force curves and force maps of NID and NHF files. `ForceSettings` and
14
+ `ForceAnalysis` process them: smoothing, baseline (offset, tilt, or an interference sine with its period found),
15
+ contact point, indentation, adhesion, pull-off, adhesion and dissipated energy, and the model fit. `Results` has
16
+ statistics, maps, masks, fits of different models on different regions, a quality filter (leave out fits below an R²)
17
+ and CSV export. Maps can be analyzed partly (every n-th line and column, or a region).
18
+ - `iv`: I-V curves with dI/dV, normalized conductance, zero-bias conductance and resistance, gap and rectification.
19
+
20
+ ### Color maps
21
+ - 12 maps are defined in `colormaps.py` (`NANOSURF`): Sky (the default for heights), Warm, Flare, Caribbean, Strata,
22
+ Gold, Digitalis, Neon, Plum, Cold, Spectrum and Maple, plus BlueBlackRed. `register()` adds them and their reversed
23
+ versions (`Sky_r`) to matplotlib; `colormap(name)` returns any of them or a matplotlib map.
24
+ - The 59 Gwyddion gradient files that 2.3.0 included are removed: they are GPL, NSFopen is MIT. An installed Gwyddion's
25
+ gradients are found on Windows, macOS and Linux (`gwyddion_dirs`, `gwyddion_gradients`, `register(gwyddion=True)`), and
26
+ `colors(name)` uses them when the name is not one of the 12.
27
+
28
+ ### Changes that can affect existing scripts
29
+ | What | 2.3.0 | 2.4.0 |
30
+ |---|---|---|
31
+ | `colors(name)` with a Gwyddion name | 59 gradient files in the package | 12 maps defined in the code; `Pm3d`, `Blend2`, `Code-V` open as `Flare`, `Strata`, `Spectrum`; the others only with an installed Gwyddion or `gwy_dir=` |
32
+ | `colormaps.GRADIENTS` | The gradient folder | Removed |
33
+
34
+ ### Examples
35
+ - New `Force_Spectroscopy/Contact_Models.py`: a force map fitted with `process.spectroscopy`, with statistics, the
36
+ quality filter, maps of the modulus and adhesion, and the stiffest curve with its fit.
37
+
38
+ ### Packaging
39
+ - Credentials (`tokens.json`, `.env`, `*.token`) in the example folders are never packaged.
40
+
41
+ ## 2.3.0 (November 2, 2026)
42
+
43
+ Compared to **2.2.4**, the latest version on PyPI (August 2024).
44
+
45
+ ### Highlights
46
+ - `pip install NSFopen` now works by itself: the `nanosurf` and `scikit-learn` packages are no longer needed.
47
+ - NID files are read about 5 times faster, and line flattening is about twice as fast.
48
+ - NHF spectroscopy files of any size open immediately, and their curves are read when asked for.
49
+ - WaveMode NMA files are read, with a curve for every pixel and maps of any quantity.
50
+ - `process` has many new image analysis functions, brought over from the Nanosurf Surface Analyzer (now NSSA).
51
+ - Figures take their units and labels from the file, can be placed in subplots, and there is a new 3D plot.
52
+
53
+ ### Reading files
54
+ Added:
55
+ - New NHF reader that needs only h5py, for file versions 1.1 and 2.0 to 2.6. Images are identical to those of Nanosurf's
56
+ reader on versions 1.1, 2.0, 2.3, 2.4 and 2.6.
57
+ - Spectroscopy (`afm.spec`): segments, grid position, other units through the file's calibration, force curves.
58
+ - WaveMode NMA (`afm.nma`): `curve()` gives Z, interaction and force of a pixel; `map()` builds per-pixel maps.
59
+ - `afm.units` holds the unit of every channel. `afm.close()` releases an NHF file; `read` also works in a `with` block.
60
+ - `read(..., measurement=)` picks a measurement of an NHF file.
61
+
62
+ Fixed:
63
+ - 2.2.4 needed `nanosurf` to be imported but did not declare it, and failed on NHF files with `nanosurf` 2.0.7.
64
+ - NID headers were read as Latin-1, so units and sizes came out as `°` and `3µm`.
65
+ - Duplicate `Wait` segments of older NHF files overwrote each other: the second is now `Wait 2`.
66
+ - A third NID channel of the same name overwrote the second: they are now `Amplitude`, `Amplitude2`, `Amplitude3`.
67
+ - A truncated NID file now says so.
68
+
69
+ ### Processing images
70
+ Added:
71
+ - Leveling: `level_flatten`, `level_poly2d`, `level_lines`, `level_align_rows`, `level_facet`, `level_three_point`,
72
+ `level_median`, `level_rolling_ball`, `level_shift`.
73
+ - Filters: `filter_basic`, `filter_median`, `filter_gaussian`, `filter_fft`, `filter_notch`.
74
+ - Glitches: `glitch_spikes`, `glitch_lines`, `glitch_auto_lines`, `glitch_scars`, `glitch_step_lines`, `glitch_fill_mask`.
75
+ - Masks, kept per channel: `set_mask` and `mask_threshold`, `mask_otsu`, `mask_watershed`, `mask_outliers`, `mask_scars`,
76
+ `mask_shape`, `mask_floodfill`, `mask_grow`, `mask_shrink`, `mask_invert`, `mask_clear`, `mask_remove_small`,
77
+ `mask_fill_holes`. Leveling, filters and statistics can use the mask.
78
+ - Geometry and scale: `geometry_crop`, `geometry_flip`, `geometry_rotate`, `geometry_resample`, `geometry_square_pixels`,
79
+ `rescale_scale`, `rescale_z_to_reference`, `rescale_xy`.
80
+ - Statistics after ISO 25178: `statistics`, `bearing_curve`, `histogram_fit`, `slope_distributions`.
81
+ - Lines: `line_profile`, `step_heights`, `critical_dimension`, `masked_step_height`, and `profile_roughness` after
82
+ ISO 21920.
83
+ - Spectra and texture: `psd`, `psd_fit`, `spectrum`, `acf`, `line_functions`, `rms_by_scale`, `lattice`.
84
+ - Grain analysis: `grains`.
85
+ - Two channels: `combine`, `find_shift`.
86
+ - Access: `channels`, `array`, `set_channel`, `size`, `unit`, `origin`, and `apply` and `operations`.
87
+
88
+ Fixed:
89
+ - `NSFopen.process` could not be imported, because `colormaps.py` imported itself.
90
+ - `flatten(inplace=False)` and similar calls changed the data as well as returning the result.
91
+ - `plane_level` was wrong on non-square images.
92
+ - The physical sizes of non-square NHF images were swapped.
93
+
94
+ ### Figures
95
+ Added:
96
+ - `plot3d`, a 3D view after the Surface Analyzer's, with materials, lighting and overlays of another channel. It needs no
97
+ graphics card.
98
+ - `plot_profile`, `plot_psd`, `plot_histogram_fit`, `plot_bearing`, `plot_acf`.
99
+ - `ax=` to draw into subplots, and `figsize`, `dpi`, `theme` and `color_range` on the plots.
100
+ - `image(profile=)` shows where a line cut lies.
101
+ - Color maps by name, including the Gwyddion gradients now included with the package: `cmap='Gold'`.
102
+
103
+ Fixed:
104
+ - The default scale bar had zero length on scans of about 2.5 µm or less, and non-integer lengths were labelled wrongly.
105
+ - `hist(color=)` raised an error.
106
+
107
+ ### Changes that can affect existing scripts
108
+ | What | 2.2.4 | 2.3.0 |
109
+ |---|---|---|
110
+ | NHF force curves `[row, col]` | Position in the file | True grid position, row 0 at the bottom |
111
+ | NHF force curves | Arrays | Read on access; `np.asarray(curves)` gives the array |
112
+ | `image` and `hist`, `scale` | `1e9` for every channel | A readable unit from the channel; `scale=1e9` still forces it |
113
+ | `hist`, `xlabel` | `Z-Axis [nm]` for every channel | The channel and its unit |
114
+ | `image`, color bar | Only with `cbar=` | Always; `colorbar=False` turns it off |
115
+ | `image`, pixels | matplotlib's default | `interpolation='nearest'`; can be overridden |
116
+ | `remove_outliers` | Nearest neighbors with scikit-learn | Interpolation from the pixels around; the numbers differ, and `neighbors` is gone |
117
+ | Unknown channel | pandas `KeyError` | `ValueError` that lists the channels |
118
+ | Default channel | `Z-Axis` only | Falls back to `Topography` in files that have no `Z-Axis` |
119
+ | `NSFopen.read.checkFileType` | Present | Removed |
120
+
121
+ `stats()` keeps its results, including `Sku` as excess kurtosis (0 for a Gaussian surface). The new `statistics()` gives
122
+ the ISO value of `Sku` (3 for a Gaussian surface).
123
+
124
+ ### Examples
125
+ - All are rewritten around `process`, and there is a new `Grain_Analysis`.
126
+ - **`Spring_Constant`: the result changes from 14.5 to 24.0 N/m.** The old fit used a power formula on amplitude data and
127
+ found Q = 253; the file records Nanosurf's own Q of 442, and the corrected fit finds 417.
128
+ - `Plotting_Data`: the image was drawn upside down.
129
+ - `Force_Spectroscopy`: the map axes were labelled µm but showed pixels.
130
+ - `Sharpen_Image`: it no longer passes the data through an 8-bit JPEG, and needs neither OpenCV nor PIL.
131
+ - `Plane_Removal`: it crashed on non-square images, and its clipping changed the data.
132
+ - `Lateral_Force`: the offset between the scans is measured instead of set by hand.
133
+ - Renamed without spaces: `Plotting_Data.py`, `Lateral_Force_Processing.py`, `Sharpen_Image.py`.
134
+
135
+ ### Requirements
136
+ - matplotlib 3.6 or newer; the other requirements are unchanged (numpy, scipy, pandas, h5py, Python 3.9 or newer).
137
+ - Removed: `nanosurf` and `scikit-learn`, which 2.2.4 used without declaring them.
138
+
139
+ ## Earlier versions
140
+ The earlier releases have no change notes. Their list and dates are on
141
+ [PyPI](https://pypi.org/project/NSFopen/#history).
@@ -0,0 +1 @@
1
+ include CHANGELOG.md
@@ -20,7 +20,7 @@ def example_path() -> pathlib.Path:
20
20
 
21
21
 
22
22
  def help():
23
- print("Nanosurf NID and NHF file reader:")
23
+ print("Nanosurf NID and NHF file reader and image analysis:")
24
24
  print("-------------------------------")
25
25
  print(f"Installed version: {__version__}")
26
26
  print("\nExamples are stored here:")
@@ -0,0 +1 @@
1
+ __version__ = "2.4.0"