Skip to content

Commit 990d666

Browse files
j-c-cgarrettwrong
authored andcommitted
cache sim, post preprocessing, post averages
1 parent f067b3c commit 990d666

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

gallery/tutorials/pipeline_demo.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# For this ``Simulation`` we set all 2D offset vectors to zero,
9090
# but by default offset vectors will be randomly distributed.
9191
# We cache the Simulation to prevent regenerating the projections
92-
# for each preproccesing stage.
92+
# for each preprocessing stage.
9393
src = Simulation(
9494
n=2500, # number of projections
9595
vols=original_vol, # volume source
@@ -137,39 +137,47 @@
137137
# efficiency of subsequent pipeline stages. Metadata such as pixel size is
138138
# scaled accordingly to correspond correctly with the image resolution.
139139

140-
src = src.downsample(res).cache()
140+
src = src.downsample(res)
141141
src.images[:10].show()
142142

143143
# %%
144144
# CTF Correction
145145
# --------------
146146
# We apply ``phase_flip()`` to correct for CTF effects.
147147

148-
src = src.phase_flip().cache()
148+
src = src.phase_flip()
149149
src.images[:10].show()
150150

151151
# %%
152152
# Normalize Background
153153
# --------------------
154154
# We apply ``normalize_background()`` to prepare the image class averaging.
155155

156-
src = src.normalize_background().cache()
156+
src = src.normalize_background()
157157
src.images[:10].show()
158158

159159
# %%
160160
# Noise Whitening
161161
# ---------------
162162
# We apply ``whiten()`` to estimate and whiten the noise.
163163

164-
src = src.whiten().cache()
164+
src = src.whiten()
165165
src.images[:10].show()
166166

167167
# %%
168168
# Contrast Inversion
169169
# ------------------
170170
# We apply ``invert_contrast()`` to ensure a positive valued signal.
171171

172-
src = src.invert_contrast().cache()
172+
src = src.invert_contrast()
173+
174+
# %%
175+
# Caching
176+
# -------
177+
# We apply ``cache`` to store the results of the ``ImageSource``
178+
# pipeline up to this point. This is optional, but can provide
179+
# benefit when used intently on machines with adequate memory.
180+
src = src.cache()
173181

174182
# %%
175183
# Class Averaging

0 commit comments

Comments
 (0)