Stokes.from_matrix should check the the matrix is a colum
Issue #7
resolved
When a row vector is passed to Stokes.from_matrix
no error is raised, but then other methods such as normalize
and check
fail in unclear ways.
Example code:
j1 = Stokes()
j1.from_matrix([1, 1, 0, 0]) # Should raise a clear error
j1.check()
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/media/work/software/peg/.venv/lib/python3.8/site-packages/py_pol/stokes.py", line 293, in check
s0 = np.asscalar(self.M[0])
File "<__array_function__ internals>", line 5, in asscalar
File "/media/work/software/peg/.venv/lib/python3.8/site-packages/numpy/lib/type_check.py", line 575, in asscalar
return a.item()
ValueError: can only convert an array of size 1 to a Python scalar
Comments (2)
-
-
- changed status to resolved
The new version has been released.
- Log in to comment
True, it should check it. The new version that will be uploaded soon will have that problem resolved.