# What's New in *playNano* 0.5.2 **Release date:** 2026-11-18 This is a bug-fix release, and upgrading is recommended for all users. It restores loading of `.asd` files and `.jpk`/`.spm` folders with AFMReader 0.0.8, and fixes several errors that gave wrong results without any warning: in frame alignment, in analysis exports and in the `playnano analyze` command. ## Before You Upgrade - **Re-run `full_cross_correlation` alignment.** `align_frames` with `method="full_cross_correlation"` found no drift on typical AFM data, so frames were left unaligned. Any results produced with this method should be regenerated. - **`playnano analyze` writes to `./output` by default.** Without `--output-folder`, results now go to an `output` folder in the current directory, as the help text always said. Scripts that expected the files in the current directory need updating. - **`playnano gui` has been removed.** It never worked; use `playnano play` to open the GUI. - **Your own scripts that use AFMReader directly** need updating for AFMReader 0.0.8, whose loaders now return an `AFMScan` object instead of a tuple (see below). ## Fixed ### Loading data - **AFMReader 0.0.8 Support:** AFMReader 0.0.8 (released 18 Nov 2026) changed its loaders to return an `AFMScan` object instead of a tuple. With playNano 0.5.1, loading `.asd` files and `.jpk` or `.spm` folders failed with `TypeError: cannot unpack non-iterable AFMScan object`. playNano now works with AFMReader 0.0.7 and 0.0.8 and gives identical data with both. The dependency is now bounded (`afmreader>=0.0.7,<0.0.9`), so a future AFMReader release cannot break loading without warning. ### Frame alignment - **Full Cross-Correlation:** `align_frames(method="full_cross_correlation")` returned zero shifts for any data with a height offset, which is usual for AFM. It now subtracts each frame's mean, as the FFT method already did, and both methods find the same shifts. `align_frames` is now version 0.2.0. - **NaN Pixels:** A single NaN pixel broke alignment. `align_frames` shifted that frame by almost the whole image, and `rolling_frame_align` returned a zero shift for every frame. This affected data with missing pixels and any stack aligned a second time after `mode="pad"`. NaN pixels are now ignored when finding shifts and kept in the output. A frame with no finite pixels raises a clear `ValueError`. - **Border Mask After Cropping:** With `mode="crop"` or `mode="crop_square"`, the `border_mask` in the metadata had the wrong shape or covered the wrong region. It is now cropped with the same bounds as the frames. `rolling_frame_align` is now version 0.1.1. ### Analysis export - **Truncated JSON:** The analysis JSON written by `playnano analyze`, the wizard and `AnalysisPipeline.run(log_to=...)` replaced anything nested more than six levels deep with `"<... truncated depth 7 ...>"`, so every bounding box from `particle_region_extraction` was lost. All values are now written. - **HDF5 Round Trip:** Analysis HDF5 files now reload exactly as written. Before, `None` came back as `'None'`, empty dicts as lists, floats as integers, and a key named `values` crashed the loader. Files from earlier versions still load. - **DBSCAN Results:** `playnano analyze` with `dbscan_clustering` failed after the analysis had finished, so nothing was saved. - **Repeated Runs:** Running a pipeline twice on the same stack kept results from earlier steps that were not repeated. Each run now starts fresh. - **Output Paths:** `AnalysisPipeline.run(log_to=...)` now creates missing folders, and `export_analysis_to_json` accepts a bare filename such as `results.json`. ### Command line and GUI - **Input Protection:** `playnano analyze` could overwrite its input `.h5` bundle with the analysis results. `analyze`, the wizard and `export_bundles` now refuse to write over the input file. - **Output Names:** Names such as `exp_1.5nM_protein` are no longer cut at the first dot. Only known file extensions are removed. - **Paths Containing `--`:** `playnano play` no longer rejects paths such as `run--2/sample.h5-jpk`. - **Wizard Errors:** An unsupported export format no longer ends the wizard session. - **Scale Bar:** `--scale-bar-nm 0` now switches the scale bar off instead of showing a 100 nm bar. - **Playback Speed:** The default speed in `playnano play` now comes from the frame timing, so bidirectional scans no longer play at half speed. Series slower than 1 frame per second play at 5 fps. ### Citation - **Zenodo Archiving:** `CITATION.cff` failed validation, so Zenodo could not archive 0.5.1. It now validates and includes the author's ORCID. ## Changed - `export_bundles` raises `ValueError` for an unsupported format instead of exiting the Python process, so scripts can handle the error. ## Removed - The `playnano gui` subcommand (use `playnano play`). - The broken `median_filter` and `particle_detect` entry points, which pointed to code that does not exist. ## Updating Your Own AFMReader Code If your notebooks or scripts call AFMReader directly, code such as ```python image, px_to_nm = load_spm(path, "Height Sensor") ``` fails with AFMReader 0.0.8. Either keep the previous version with `pip install "afmreader<0.0.8"`, or use the new attributes: ```python scan = load_spm(path, "Height Sensor") image, px_to_nm = scan.image, scan.pixel_to_nanometre_scaling ``` For the full list of changes, see the **Changelog**.