Skip to main content

DOI PyPI PyPI - Python Version Tests

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

Read more: Efficient Double Helix Detection with Steerable Filters. Barentine, A.E.S., Balaji, A., Moerner, W.E. (2025). bioRxiv 2025.08.14.670427

Quick install

pip install pyme-double-helix

followed by

double-helix-install-plugin

Installation / Set up

  1. Install PYME using your preferred method.
  2. Using git, clone this repository to your machine.
  3. In a terminal/shell with your conda environment activated, run pip install . from the top double_helix directory (use pip 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

  1. Check that PYME finds this plugin by opening PYMEImage (in test mode: PYMEImage -t), clicking the Modules menu, and looking for DH_Calibration near the very top (you may have to scroll up).
  2. If the DH_Calibration module is not present, try re-registering explicitly by running double-helix-install-plugin in 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

  1. 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 psfExtraction module. The extraction process is described in the PYME documentation.
  2. Once you have your extracted PSF open in PYMEImage, load the double-helix calibration module by clicking on DH_Calibration in the Modules menu near the top.
  3. In the Processing menu, click Calibrate DH PSF.
  4. Save the resulting calibration as a .dh_json file. The calibration plots will be automatically saved in the same directory as a png.

Cubic spline fitting

  1. Open your bead stack in PYMEImage.
  2. Load the double-helix calibration module by clicking on DH_Calibration in the Modules menu near the top.
  3. Click the center of a bead image and click Tag Bead in the lower left DH PSF Extraction panel. If you adjust the ROI half size, press Clear and re-tag the bead. Similarly if you prefer to align the beads on a slice other than the center of the Z-stack, adjust Center slice and re-tag.
  4. After selecting the beads you would like to average, click Extract PSF.
  5. If the extracted PSF stack is satisfactory, save it to .h5 or .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).

  1. With your PSF stack or single-frame open in PYMEImage, and the DH_Calibration module loaded, click Optimize DH PSF Detection in the Processing menu.
  2. 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 PSF step. 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.
  3. Note the value which maximizes the strength in the resulting plot (included in the title).
  4. We recommend looking at the raw "strength map" by clicking Test DH PSF Detection in the Processing menu.
  5. 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 Thresh value is scaled by an estimate of signal to noise at each pixel, requiring that any 'candidate' detections be above this value. An optimal Thresh value can be determined at later stages.
  6. 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.

  1. Start the PYMEClusterOfOne.
  2. Open your image series in PYMEImage
  3. If your image is not an .h5 file type, you will likely need to activate the LMAnalysis module
  4. In the Type dropdown of the Analysis panel on the left, select double_helix.DoubleGaussFit or double_helix.SplineFit.
  5. Select your prefered background subtraction. We recommend checking Use percentile for background.
  6. If you have variance, dark, or flat maps to load, do so. Otherwise, scalar values will be used as listed in the metadata.
  7. 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.
  8. if using double_helix.SplineFit, use the Set button next to PSF: to load your extracted PSF .h5 or .tif.
  9. Enter a value for the detection filter sigma as optimized above.
  10. Click Test This Frame and see how well molecules are detected and fitted. Adjust the Thresh value, 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:

  1. Open a set of localized points in PYMEVis.
  2. In the Corrections menu, click Double Helix > Map and Filter on DH parameters.
  3. 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.
  4. The z column of the output datasource will be automatically adjusted to now include the dh_z position (added to any focus information 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)

Source distribution for pyme-double-helix 26.5.22
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)

Table of built distributions (wheels) for pyme-double-helix 26.5.22
File Interpreter ABI Platform Actions
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 log

Release 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 log

Security 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.

Select from 2 files

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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page