Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/test_coordinate_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import mrcfile
import numpy as np
import pytest
from click.testing import CliRunner
from pandas import DataFrame

Expand Down Expand Up @@ -275,7 +276,7 @@ def createTestCtfFiles(self, index):
starfile = StarFile(blocks=blocks)
starfile.write(star_fp)

def createTestRelionCtfFile(self):
def createTestRelionCtfFile(self, reverse_optics_block_rows=False):
"""
Creates example RELION-generated CTF file for a set of micrographs.
"""
Expand All @@ -295,6 +296,11 @@ def createTestRelionCtfFile(self):
["opticsGroup1", 1, 500.0, 700.0, 600.0, 400.0],
["opticsGroup2", 2, 501.0, 701.0, 601.0, 401.0],
]
# Since optics block rows are self-contained,
# reversing their order should have no affect anywhere.
if reverse_optics_block_rows:
optics_block = optics_block[::-1]

blocks["optics"] = DataFrame(optics_block, columns=optics_columns)

micrographs_columns = [
Expand Down Expand Up @@ -539,6 +545,16 @@ def testImportCtfFromRelion(self):
self._testCtfFilters(src)
self._testCtfMetadata(src)

@pytest.mark.xfail(strict=True)
def testImportCtfFromRelionReverseOpticsGroup(self):
self.relion_ctf_file = self.createTestRelionCtfFile(
reverse_optics_block_rows=True
)
src = BoxesCoordinateSource(self.files_box)
src.import_relion_ctf(self.relion_ctf_file)
self._testCtfFilters(src)
self._testCtfMetadata(src)

def testImportCtfFromRelionLegacy(self):
src = BoxesCoordinateSource(self.files_box)
src.import_relion_ctf(self.relion_legacy_ctf_file)
Expand Down