| 8 | |
| 9 | |
| 10 | class MPBData: |
| 11 | |
| 12 | TWOPI = 6.2831853071795864769252867665590057683943388 |
| 13 | |
| 14 | def __init__( |
| 15 | self, |
| 16 | lattice=None, |
| 17 | kpoint=None, |
| 18 | rectify=False, |
| 19 | x=0, |
| 20 | y=0, |
| 21 | z=0, |
| 22 | periods=0, |
| 23 | resolution=0, |
| 24 | phase_angle=0, |
| 25 | pick_nearest=False, |
| 26 | ve=None, |
| 27 | verbose=False, |
| 28 | ): |
| 29 | |
| 30 | self.lattice = lattice |
| 31 | self.kpoint = kpoint |
| 32 | self.rectify = rectify |
| 33 | |
| 34 | if periods: |
| 35 | self.multiply_size = [periods, periods, periods] |
| 36 | else: |
| 37 | self.multiply_size = [x or 1, y or 1, z or 1] |
| 38 | |
| 39 | self.resolution = resolution |
| 40 | self.phase_angle = phase_angle |
| 41 | self.pick_nearest = pick_nearest |
| 42 | self.ve = ve |
| 43 | |
| 44 | if self.ve: |
| 45 | self.have_ve = True |
| 46 | self.rectify = True |
| 47 | else: |
| 48 | self.have_ve = False |
| 49 | self.ve = mp.Vector3(1, 0, 0) |
| 50 | |
| 51 | self.verbose = verbose |
| 52 | self.scaleby = complex(1, 0) |
| 53 | |
| 54 | self.phase = complex( |
| 55 | math.cos(self.TWOPI * self.phase_angle / 360.0), |
| 56 | math.sin(self.TWOPI * self.phase_angle / 360.0), |
| 57 | ) |
| 58 | self.scaleby *= self.phase |
| 59 | |
| 60 | def handle_dataset(self, in_arr): |
| 61 | |
| 62 | out_dims = [1, 1, 1] |
| 63 | rank = len(in_arr.shape) |
| 64 | num_ones = 3 - rank |
| 65 | in_dims = list(in_arr.shape) + [1] * num_ones |
| 66 | |
| 67 | if np.iscomplexobj(in_arr): |
nothing calls this directly
no outgoing calls
no test coverage detected