This plugin enables double-helix point-spread function detection and localization fitting within the Python Microscopy Environment (PYME). This plugin has been developed in the Moerner Lab at Stanford University.
Key Features
- highly efficient detection of double-helix point-spread functions using just 7 (separable) convolutions
- Double-gaussian localization fitting parameterized on lobe separation and orientation, which enables direct estimates of their uncertainties
- Cubic spline localization fitting with initial Z guessed from detected orientation
Quick install
pip install pyme-double-helix
followed by
double-helix-install-plugin
Installation / Set up
- Install PYME using your preferred method.
- Using git, clone this repository to your machine.
- In a terminal/shell with your conda environment activated, run
pip install .from the topdouble_helixdirectory (usepip install -e .if you want an editable/development install). If you used an executable installer for PYME, look for an "Anaconda prompt (python-microscopy)" shell in your start menu.
Troubleshooting
- Check that PYME finds this plugin by opening PYMEImage (in test mode:
PYMEImage -t), clicking theModulesmenu, and looking forDH_Calibrationnear the very top (you may have to scroll up). - If the
DH_Calibrationmodule is not present, try re-registering explicitly by runningdouble-helix-install-pluginin the shell.
Usage
Metadata
It is imperative to have correct metadata for good localization. If your data was not acquired using PYME, please see PYME's analyzing foreign data documentation.
PSF calibration
Calibrating your point-spread function is a great way to start. While this calibration is not necessary for model-based fitting, it is used to eventually convert the orientation of the double-helix to a z position for a localized molecule. Additionally, calibrating your PSF will help determine optimal detection settings, and is necessary for spline-based fitting.
Model based (Double Gaussian) fitting
- Open your bead stack in PYMEImage. If you already have a cropped Z-stack of a single bead, your "extracted PSF", proceed to the next step. If you have multiple beads in the same field of view, you may wish to enable the PYME
psfExtractionmodule. The extraction process is described in the PYME documentation. - Once you have your extracted PSF open in PYMEImage, load the double-helix calibration module by clicking on
DH_Calibrationin theModulesmenu near the top. - In the
Processingmenu, clickCalibrate DH PSF. - Save the resulting calibration as a
.dh_jsonfile. The calibration plots will be automatically saved in the same directory as a png.
Cubic spline fitting
- Open your bead stack in PYMEImage.
- Load the double-helix calibration module by clicking on
DH_Calibrationin theModulesmenu near the top. - Click the center of a bead image and click
Tag Beadin the lower leftDH PSF Extractionpanel. If you adjust the ROI half size, pressClearand re-tag the bead. Similarly if you prefer to align the beads on a slice other than the center of the Z-stack, adjustCenter sliceand re-tag. - After selecting the beads you would like to average, click
Extract PSF. - If the extracted PSF stack is satisfactory, save it to
.h5or.tif.
Filter Optimization
The detection filter has a width scaling parameter, filter sigma, which you will want to have tuned to your PSF.
You can run this process on the same PSF stack used above, or on a single frame of it (File>Extract cropped).
- With your PSF stack or single-frame open in
PYMEImage, and theDH_Calibrationmodule loaded, clickOptimize DH PSF Detectionin theProcessingmenu. - In the pop-up GUI, adjust the lobe separation and lobe sigma paramters
to reasonable values based on the plot displayed in the
Calibrate DH PSFstep. Adjust the filter sigma search range and stride as you like. We find that a filter sigma (units of pixels) times the pixelsize (in nanometers) equal to roughly half of the lobe separation (units of nanometers) is a reasonable center of your range. Start with a wide stride your first time running this so that you do not wait too long for the process to finish, then adjust your search. - Note the value which maximizes the strength in the resulting plot (included in the title).
- We recommend looking at the raw "strength map" by clicking
Test DH PSF Detectionin theProcessingmenu. - In the pop-up GUI, enter the filter sigma determined from the optimization, as well as your other PSF parameters (lobe separation and lobe sigma). The
Threshvalue is scaled by an estimate of signal to noise at each pixel, requiring that any 'candidate' detections be above this value. An optimalThreshvalue can be determined at later stages. - If the resulting filtered image does not show a single prominence centered on the PSF, try again with a larger filter sigma value.
Localization fitting
Start by familiarizing yourself with the localization workflow in PYME, documented here. PYME can facilitate distributed batch analysis of many series, but we will describe how to localize a single series here.
- Start the
PYMEClusterOfOne. - Open your image series in
PYMEImage - If your image is not an
.h5file type, you will likely need to activate theLMAnalysismodule - In the
Typedropdown of theAnalysispanel on the left, selectdouble_helix.DoubleGaussFitordouble_helix.SplineFit. - Select your prefered background subtraction. We recommend checking
Use percentile for background. - If you have variance, dark, or flat maps to load, do so. Otherwise, scalar values will be used as listed in the metadata.
- Enter your double helix detection settings, as informed by your PSF calibration. The expected lobe separation [nm], and expected lobe sigma [nm] should be set using reasonable ~middle values from your PSF calibration.
- if using
double_helix.SplineFit, use theSetbutton next toPSF:to load your extracted PSF.h5or.tif. - Enter a value for the detection filter sigma as optimized above.
- Click
Test This Frameand see how well molecules are detected and fitted. Adjust theThreshvalue, and any other settings as necessary.
Z-lookup for fitted localizations
Z lookup is built-into double_helix.SplineFit, but for DoubleGaussFit the fitted orientation must be mapped to the calibrated Z position:
- Open a set of localized points in
PYMEVis. - In the
Correctionsmenu, clickDouble Helix > Map and Filter on DH parameters. - Select the dh_json calibration from above, and if necessary, adjust the target knot spacing. A cubic spline is fitted to the calibration data and used to look-up individual localization's z position. The target knot spacing of that spline is adjustable, within some limits of the spacing of the original calibration - increase the knot spacing if the default setting is too small for your calibration data.
- The
zcolumn of the output datasource will be automatically adjusted to now include thedh_zposition (added to anyfocusinformation of individual localizations, potentially with a foreshortening correction). Several double-helix specific filters will be automatically added to the pipeline and may need to be adjusted for your use case.
Metadata
Release files for pyme-double-helix 26.5.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyme_double_helix-26.5.22.tar.gz | 68.0 kB | With provenance | Details for pyme_double_helix-26.5.22.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyme_double_helix-26.5.22-py3-none-any.whl | Python 3 | none | any | Details for pyme_double_helix-26.5.22-py3-none-any.whl |
Total release size: 144.4 kB
Release files / pyme_double_helix-26.5.22.tar.gz
| Download URL | pyme_double_helix-26.5.22.tar.gz |
|---|---|
| Size | 68.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85ef4252d498c1082ccd708264dc50cd5ccf819d9c7366799c8242be2e8bce7d
|
|
BLAKE2b-256 checksum How to use checksums |
fc80e0b9ca07e68fc9de0276c17f27a26e94522ff44aeb491a2e1d114d99e27d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logRelease files / pyme_double_helix-26.5.22-py3-none-any.whl
| Download URL | pyme_double_helix-26.5.22-py3-none-any.whl |
|---|---|
| Size | 76.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59eb017f1112a6c030ad8fa3e2b0d61cb7358e7e032bfbfbc036eaa0203b9245
|
|
BLAKE2b-256 checksum How to use checksums |
e416bdf93f9d1dad5dfe7ac21e14fa709ffe1f9ea045911206edeae2b832a756
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logSecurity for pyme-double-helix 26.5.22
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pyme_double_helix-26.5.22.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.