-
Notifications
You must be signed in to change notification settings - Fork 26
Enable RelionSource to be created with no metadata
#522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4b108d3
e418e80
a46e582
6dc4b3e
a9a10a5
b2a7d0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,7 @@ def __init__( | |
| if unique_filters: | ||
| if filter_indices is None: | ||
| filter_indices = randi(len(unique_filters), n, seed=seed) - 1 | ||
| self._populate_ctf_metadata(filter_indices) | ||
| self.filter_indices = filter_indices | ||
| else: | ||
| self.filter_indices = np.zeros(n) | ||
|
|
@@ -105,6 +106,41 @@ def __init__( | |
| logger.info("Appending a NoiseAdder to generation pipeline") | ||
| self.noise_adder = NoiseAdder(seed=self.seed, noise_filter=noise_filter) | ||
|
|
||
| def _populate_ctf_metadata(self, filter_indices): | ||
| # Since we are not reading from a starfile, we must construct | ||
| # metadata based on the CTF filters by hand and set the values | ||
| # for these columns | ||
| # | ||
| # class attributes of CTFFilter: | ||
| CTFFilter_attributes = ( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if these would be better as a dictionary mapping between
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah there is a one-to-one correspondence. But the two sets of strings are used separately, so I think to do the |
||
| "voltage", | ||
| "defocus_u", | ||
| "defocus_v", | ||
| "defocus_ang", | ||
| "Cs", | ||
| "alpha", | ||
| ) | ||
| # get the CTF parameters, if they exist, for each filter | ||
| # and for each image (indexed by filter_indices) | ||
| filter_values = np.zeros((len(filter_indices), len(CTFFilter_attributes))) | ||
| for i, filt in enumerate(self.unique_filters): | ||
| filter_values[filter_indices == i] = [ | ||
| getattr(filt, att, np.nan) for att in CTFFilter_attributes | ||
| ] | ||
| # set the corresponding Relion metadata values that we would expect | ||
| # from a STAR file | ||
| self.set_metadata( | ||
| [ | ||
| "_rlnVoltage", | ||
| "_rlnDefocusU", | ||
| "_rlnDefocusV", | ||
| "_rlnDefocusAngle", | ||
| "_rlnSphericalAberration", | ||
| "_rlnAmplitudeContrast", | ||
| ], | ||
| filter_values, | ||
| ) | ||
|
|
||
| def projections(self, start=0, num=np.inf, indices=None): | ||
| """ | ||
| Return projections of generated volumes, without applying filters/shifts/amplitudes/noise | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.