Skip to content

Commit

Permalink
Add dask support for Snap rotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dmentipl committed Apr 14, 2020
1 parent d7c82e6 commit 51d2c18
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plonk/snap/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from pathlib import Path
from typing import Any, Callable, Dict, List, Set, Tuple, Union, cast

import dask
import dask.array as da
import h5py
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -915,7 +917,14 @@ def _get_array_from_registry(self, name: str, sinks: bool = False):
else:
array = self._array_registry[name](self)
if self.rotation is not None and name in self._vector_arrays:
array = self.rotation.apply(array)
if self.backend == 'dask':
array = da.from_delayed(
dask.delayed(self.rotation.apply(array)),
shape=array.shape,
dtype=array.dtype,
)
else:
array = self.rotation.apply(array)
if self.translation is not None and name == 'position':
array += self.translation
if self._physical_units:
Expand Down

0 comments on commit 51d2c18

Please sign in to comment.