Created
April 12, 2019 02:29
-
-
Save ZGainsforth/c6e556eb08c6c63fd09b5b08d7005618 to your computer and use it in GitHub Desktop.
Python script to run GENFIRE on a server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import genfire as gf | |
| import sys, os, shutil | |
| import argparse | |
| # Parse command line arguments. | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("fileroot", help="There should be an aligned tomo stack named fileroot_aligned.npy in the directory and a the reconstruction will be named fileroot_reconstruction.mrc.") | |
| parser.add_argument("-n", "--numIterations", help="Default number of GENFIRE iterations. See GENFIRE documentation. Default=100.", type=int, default=100, action="store") | |
| parser.add_argument("-o", "--oversamplingRatio", help="How many times bigger to make the fourier space. Bigger is more accurate, but you may run out of memory. See GENFIRE documentation. Default=4.", type=int, default=4, action="store") | |
| args = parser.parse_args() | |
| # Make a reconstruction using paramaters from default or from the command line. | |
| GF = gf.reconstruct.GenfireReconstructor( | |
| projections = f"{args.fileroot}_aligned.npy", | |
| eulerAngles = "tilts.txt", | |
| resultsFilename = f"{args.fileroot}_reconstruction.mrc", | |
| numIterations = args.numIterations, | |
| interpolationCutoffDistance=0.7, | |
| oversamplingRatio=args.oversamplingRatio, | |
| resolutionExtensionSuppressionState=2, | |
| ) | |
| # Number crunch. | |
| results = GF.reconstruct() | |
| # Save results. | |
| gf.fileio.saveResults(results, GF.params.resultsFilename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment