Skip to content

Commit

Permalink
Merge pull request #282 from BradyAJohnston/test-versions
Browse files Browse the repository at this point in the history
add multiple bpy versions to test suite (bpy 3.5 / 3.6)
  • Loading branch information
BradyAJohnston committed Aug 3, 2023
2 parents 91cc1ad + 3ba0a6d commit 826425c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
max-parallel: 4
fail-fast: false
matrix:
blender-version: ["3.5.0"]
blender-version: ["3.5.0", "3.6.0"]
os: [ubuntu-latest, windows-latest]
# os: [ubuntu-latest]
steps:
Expand All @@ -24,7 +24,7 @@ jobs:
with:
python-version: '3.10'
cache: 'pip'
# - run: pip install bpy==${{ matrix.blender-version }}
- run: pip install bpy==${{ matrix.blender-version }}
# - run: pip install -r requirements.txt
- name: Install MolecularNodes + Dependencies
run: pip install .
Expand Down
6 changes: 3 additions & 3 deletions MolecularNodes/assembly/cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def get_transformations(self, assembly_id):
rotations, translations
)
transformations.append((
np.array(affected_chain_ids, dtype="U4"),
total_rotation,
total_translation
np.array(affected_chain_ids, dtype="U4").tolist(),
total_rotation.tolist(),
total_translation.tolist()
))

return transformations
Expand Down
2 changes: 1 addition & 1 deletion MolecularNodes/assembly/mmtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_transformations(self, assembly_id):
chain_ids = np.array(self._file["chainNameList"], dtype="U4")
affected_chain_ids = chain_ids[transform["chainIndexList"]]
transformations.append((
affected_chain_ids,
affected_chain_ids.tolist(),
matrix[:3, :3].tolist(),
matrix[:3, 3].tolist()
))
Expand Down
6 changes: 3 additions & 3 deletions MolecularNodes/assembly/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def get_transformations(self, assembly_id):
)
for rotation, translation in zip(rotations, translations):
transformations.append((
np.array(affected_chain_ids, dtype="U4"),
rotation,
translation
np.array(affected_chain_ids, dtype="U4").tolist(),
rotation.tolist(),
translation.tolist()
))

return transformations
Expand Down
4 changes: 2 additions & 2 deletions MolecularNodes/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def add_attribute(object: bpy.types.Object, name: str, data, type="FLOAT", domai
att = object.data.attributes.new(name, type, domain)
# currently vectors have to be added as a 1d array. may change in the future
# but currently must be reshaped then added as a 'vector' but supplying a 1d array
vec_1d = data.reshape(len(data) * 3)
vec_1d = data.reshape(len(data) * 3).copy(order = 'c')
att.data.foreach_set('vector', vec_1d)
else:
att = object.data.attributes.new(name, type, domain)
att.data.foreach_set('value', data)
att.data.foreach_set('value', data.copy(order = 'c'))

return att

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ authors = [
description = "Toolbox for molecular animations with Blender and Geometry Nodes."
requires-python = ">=3.10.0"
dependencies = [
"bpy",
"bpy>=3.5.0",
"MDAnalysis==2.5.0",
"biotite==0.37.0",
"mrcfile",
Expand Down
1 change: 0 additions & 1 deletion tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def test_1cd3_bio_assembly(snapshot):
# Results shows the same number of atoms and atom positions are resulting from the
# different import methods so it still works
positions = [np.sort(mn.obj.get_attribute(obj, 'position'), axis = 0, kind = 'quicksort')[::-1] for obj in objects]
print(positions)
assert np.allclose(positions[0], positions[1], atol = 1e-4)

# TODO: for some reason when opening from .CIF files, we are ending up with double the
Expand Down

0 comments on commit 826425c

Please sign in to comment.