|
1 | 1 | from typing import Literal, Optional |
2 | 2 |
|
3 | 3 | import matplotlib.pyplot as plt |
4 | | -import numpy as np |
5 | 4 | import torch |
6 | 5 | from matplotlib.patches import Rectangle |
7 | 6 | from scipy.constants import physical_constants |
@@ -104,14 +103,14 @@ def __init__( |
104 | 103 | if fringe_integral is not None: |
105 | 104 | self.fringe_integral = torch.as_tensor(fringe_integral, **factory_kwargs) |
106 | 105 | self.fringe_integral_exit = ( |
107 | | - torch.tensor(fringe_integral_exit, **factory_kwargs) |
| 106 | + torch.as_tensor(fringe_integral_exit, **factory_kwargs) |
108 | 107 | if fringe_integral_exit is not None |
109 | 108 | else self.fringe_integral |
110 | 109 | ) |
111 | 110 | if gap is not None: |
112 | 111 | self.gap = torch.as_tensor(gap, **factory_kwargs) |
113 | 112 | self.gap_exit = ( |
114 | | - torch.tensor(gap_exit, **factory_kwargs) |
| 113 | + torch.as_tensor(gap_exit, **factory_kwargs) |
115 | 114 | if gap_exit is not None |
116 | 115 | else self.gap |
117 | 116 | ) |
@@ -493,7 +492,7 @@ def plot(self, ax: plt.Axes, s: float, vector_idx: Optional[tuple] = None) -> No |
493 | 492 | plot_angle = self.angle[vector_idx] if self.angle.dim() > 0 else self.angle |
494 | 493 |
|
495 | 494 | alpha = 1 if self.is_active else 0.2 |
496 | | - height = 0.8 * (np.sign(plot_angle) if self.is_active else 1) |
| 495 | + height = 0.8 * (torch.sign(plot_angle) if self.is_active else 1) |
497 | 496 |
|
498 | 497 | patch = Rectangle( |
499 | 498 | (plot_s, 0), plot_length, height, color="tab:green", alpha=alpha, zorder=2 |
|
0 commit comments