Skip to content

Commit c90ed83

Browse files
authored
Merge pull request #1330 from ComputationalCryoEM/develop
Develop~~>Main v0.14.1
2 parents f8f26ee + f26be41 commit c90ed83

File tree

82 files changed

+1837
-853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1837
-853
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.14.0
2+
current_version = 0.14.1
33
commit = True
44
tag = True
55

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5657281.svg)](https://doi.org/10.5281/zenodo.5657281)
66
[![Downloads](https://static.pepy.tech/badge/aspire/month)](https://pepy.tech/project/aspire)
77

8-
# ASPIRE - Algorithms for Single Particle Reconstruction - v0.14.0
8+
# ASPIRE - Algorithms for Single Particle Reconstruction - v0.14.1
99

1010
The ASPIRE-Python project supersedes [Matlab ASPIRE](https://github.com/PrincetonUniversity/aspire).
1111

@@ -20,7 +20,7 @@ For more information about the project, algorithms, and related publications ple
2020
Please cite using the following DOI. This DOI represents all versions, and will always resolve to the latest one.
2121

2222
```
23-
ComputationalCryoEM/ASPIRE-Python: v0.14.0 https://doi.org/10.5281/zenodo.5657281
23+
ComputationalCryoEM/ASPIRE-Python: v0.14.1 https://doi.org/10.5281/zenodo.5657281
2424
2525
```
2626

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
# built documents.
8787
#
8888
# The full version, including alpha/beta/rc tags.
89-
release = version = "0.14.0"
89+
release = version = "0.14.1"
9090

9191
# The language for content autogenerated by Sphinx. Refer to documentation
9292
# for a list of supported languages.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Aspire v0.14.0
1+
Aspire v0.14.1
22
==============
33

44
Algorithms for Single Particle Reconstruction

gallery/experiments/experimental_abinitio_pipeline_10028_jsb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,15 @@
8888
logger.info("Perform phase flip to input images.")
8989
src = src.phase_flip().cache()
9090

91+
# Legacy MATLAB cropped the images to an odd resolution.
92+
src = src.crop_pad(src.L - 1).cache()
93+
9194
# Downsample the images.
9295
logger.info(f"Set the resolution to {img_size} X {img_size}")
93-
src = src.downsample(img_size).cache()
96+
src = src.legacy_downsample(img_size).cache()
9497

9598
# Normalize the background of the images.
96-
src = src.normalize_background().cache()
99+
src = src.legacy_normalize_background().cache()
97100

98101
# Estimate the noise and whiten based on the estimated noise.
99102
src = src.legacy_whiten().cache()

gallery/experiments/experimental_abinitio_pipeline_10073_jsb.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import logging
3030
from pathlib import Path
3131

32-
import numpy as np
33-
3432
from aspire.abinitio import CLSync3N
3533
from aspire.denoising import LegacyClassAvgSource
3634
from aspire.reconstruction import MeanEstimator
@@ -82,12 +80,15 @@
8280
logger.info("Perform phase flip to input images.")
8381
src = src.phase_flip().cache()
8482

83+
# Legacy MATLAB cropped the images to an odd resolution.
84+
src = src.crop_pad(src.L - 1).cache()
85+
8586
# Downsample the images.
8687
logger.info(f"Set the resolution to {img_size} X {img_size}")
87-
src = src.downsample(img_size).cache()
88+
src = src.legacy_downsample(img_size).cache()
8889

8990
# Normalize the background of the images.
90-
src = src.normalize_background().cache()
91+
src = src.legacy_normalize_background().cache()
9192

9293
# Estimate the noise and whiten based on the estimated noise.
9394
src = src.legacy_whiten().cache()
@@ -115,8 +116,8 @@
115116

116117
# We'll continue our pipeline by selecting ``n_classes`` from ``avgs``.
117118
# To capture a broader range of viewing angles, uniformly select every ``k`` image.
118-
k = (avgs.n - 1) // n_classes
119-
avgs = avgs[::k].cache()
119+
k = 3
120+
avgs = avgs[: n_classes * k : k].cache()
120121

121122

122123
# %%
@@ -133,8 +134,7 @@
133134
logger.info("Apply custom mask")
134135
# 10073 benefits from a masking procedure that is more aggressive than the default.
135136
# Note, since we've manually masked, the default masking is disabled below in `CLSync3N`.
136-
# This also upcasts to double precision, which is helpful for this reconstruction.
137-
mask = fuzzy_mask((img_size, img_size), np.float64, r0=0.4 * img_size, risetime=2)
137+
mask = fuzzy_mask((img_size, img_size), avgs.dtype, r0=0.4 * img_size, risetime=2)
138138
avgs = ArrayImageSource(avgs.images[:] * mask)
139139

140140
logger.info("Begin Orientation Estimation")
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""
2+
Legacy Preprocessing Pipeline
3+
=============================
4+
5+
This notebook demonstrates reproducing preprocessing results from the
6+
legacy ASPIRE MATLAB workflow system for the EMPIAR 10028 ribosome
7+
dataset.
8+
9+
https://www.ebi.ac.uk/empiar/EMPIAR-10028
10+
"""
11+
12+
# %%
13+
# Source data and Preprocessing
14+
# -----------------------------
15+
#
16+
# Load the data and apply preprocessing steps corresponding to the MATLAB prompts:
17+
#
18+
# >>> Phaseflip projections? (Y/N)? [Y] Y
19+
# >>> Enter pixel size in Angstrom (-1 to read from STAR file): [-1.000000]
20+
# >>> Number of projections to read? [105247]
21+
# >>> Crop? (Y/N)? [Y] Y
22+
# >>> Crop to size? [360]359
23+
# >>> Downsample? (Y/N)? [Y] Y
24+
# >>> Downsample to size? [360]179
25+
# >>> Normalize background of images to variance 1? (Y/N)? [Y]
26+
# >>> Prewhiten? (Y/N)? [Y]
27+
# >>> Split data into groups? (Y/N)? [Y] N
28+
29+
from aspire.source import RelionSource
30+
31+
# Inputs
32+
# Note the published ``shiny_2sets.star`` requires removal of a stray '9' character on line 5476.
33+
starfile_in = "10028/data/shiny_2sets_fixed9.star"
34+
# Caching, while not required, will increase speed in exchange for potentially increased memory usage.
35+
src = RelionSource(starfile_in).cache()
36+
37+
# Define preprocessing steps.
38+
src = src.phase_flip().cache()
39+
src = src.crop_pad(359).cache()
40+
src = src.legacy_downsample(179).cache()
41+
src = src.legacy_normalize_background().cache()
42+
src = src.legacy_whiten().cache()
43+
src = src.invert_contrast().cache()
44+
45+
# Save the preprocessed images.
46+
# `save_mode=single` will save a STAR file and single mrcs holding the image stack.
47+
src.save("10028_legacy_preprocessed_179px.star", save_mode="single", overwrite=True)

gallery/tutorials/aspire_introduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def noise_function(x, y):
571571

572572
# Generate several CTFs.
573573
ctf_filters = [
574-
RadialCTFFilter(pixel_size=vol_ds.pixel_size, defocus=d)
574+
RadialCTFFilter(defocus=d)
575575
for d in np.linspace(defocus_min, defocus_max, defocus_ct)
576576
]
577577

gallery/tutorials/pipeline_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
defocus_ct = 7
6868

6969
ctf_filters = [
70-
RadialCTFFilter(pixel_size=original_vol.pixel_size, defocus=d)
70+
RadialCTFFilter(defocus=d)
7171
for d in np.linspace(defocus_min, defocus_max, defocus_ct)
7272
]
7373

gallery/tutorials/tutorials/basic_image_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def noise_function(x, y):
127127
# The implementation of batching for memory management
128128
# would be managed behind the scenes for you.
129129

130-
imgs_src = ArrayImageSource(imgs_with_noise)
130+
imgs_src = ArrayImageSource(imgs_with_noise, pixel_size=1.0)
131131

132132
# We'll copy the orginals for comparison later, before we process them further.
133133
noisy_imgs_copy = imgs_src.images[:n_imgs].asnumpy()

0 commit comments

Comments
 (0)