.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_tutorials/tutorials/starfile.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_tutorials_tutorials_starfile.py: Starfile ======== .. GENERATED FROM PYTHON SOURCE LINES 6-16 .. code-block:: Python import os import matplotlib.pyplot as plt import numpy as np from aspire.noise import AnisotropicNoiseEstimator from aspire.reconstruction import MeanEstimator from aspire.source import RelionSource .. GENERATED FROM PYTHON SOURCE LINES 17-23 Sources ------- Sources are an interface to various backend stores of data (np arrays, starfiles, etc) They are intended to handle batching data conversion/prep behind the scenes. Here we load a ".star" file using the RelionSource class .. GENERATED FROM PYTHON SOURCE LINES 23-38 .. code-block:: Python data_folder = os.path.join(os.path.dirname(os.getcwd()), "data") file_path = os.path.join(data_folder, "sample_relion_data.star") source = RelionSource( file_path, pixel_size=1.338, max_rows=10000, data_folder=data_folder, ) # Reduce the resolution L = 12 # You may try 16 but it takes a significant amount of time. source = source.downsample(L) .. GENERATED FROM PYTHON SOURCE LINES 39-41 Noise Estimation and Whitening ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 41-51 .. code-block:: Python # Estimate noise in the ImageSource instance noise_estimator = AnisotropicNoiseEstimator(source) # Apply whitening to ImageSource source = source.whiten(noise_estimator) # Display subset of the images images = source.images[:10] images.show() .. image-sg:: /auto_tutorials/tutorials/images/sphx_glr_starfile_001.png :alt: starfile :srcset: /auto_tutorials/tutorials/images/sphx_glr_starfile_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/1 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: starfile.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: starfile.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_