Extend hardcoded T-matrix similarity tolerance.

Also some cython functions->properties.


Former-commit-id: 4a0605b1cf8b857c681f194a475ff3f10e7dfe71
This commit is contained in:
Marek Nečada 2019-10-07 15:15:34 +03:00
parent e7f0e0131f
commit acff55f396
3 changed files with 12 additions and 5 deletions

View File

@ -26,6 +26,9 @@ TODO list before public release
- Remove legacy code. - Remove legacy code.
- Split qpms_c.pyx. - Split qpms_c.pyx.
- Reduce compiler warnings. - Reduce compiler warnings.
- Python exceptions instead of hard crashes in the C library where possible.
- Scatsystem init sometimes fail due to rounding errors and hardcoded absolute tolerance
in the qpms_tmatrix_isclose() call.
- Prefix all identifiers. Maybe think about a different prefix than qpms? - Prefix all identifiers. Maybe think about a different prefix than qpms?
- Consistent indentation and style overall. - Consistent indentation and style overall.
- Rewrite the parallelized translation matrix, mode problem matrix generators - Rewrite the parallelized translation matrix, mode problem matrix generators

View File

@ -358,7 +358,8 @@ cdef class ScatteringSystem:
def __dealloc__(self): def __dealloc__(self):
qpms_scatsys_free(self.s) qpms_scatsys_free(self.s)
def particles_tmi(self): property particles_tmi:
def __get__(self):
r = list() r = list()
cdef qpms_ss_pi_t pi cdef qpms_ss_pi_t pi
for pi in range(self.s[0].p_count): for pi in range(self.s[0].p_count):
@ -470,7 +471,8 @@ cdef class ScatteringSystem:
self.s, iri, k, J) self.s, iri, k, J)
return target return target
def fullvec_psizes(self): property fullvec_psizes:
def __get__(self):
cdef np.ndarray[int32_t, ndim=1] ar = np.empty((self.s[0].p_count,), dtype=np.int32) cdef np.ndarray[int32_t, ndim=1] ar = np.empty((self.s[0].p_count,), dtype=np.int32)
cdef int32_t[::1] ar_view = ar cdef int32_t[::1] ar_view = ar
for pi in range(self.s[0].p_count): for pi in range(self.s[0].p_count):
@ -478,7 +480,8 @@ cdef class ScatteringSystem:
return ar return ar
def fullvec_poffsets(self): property fullvec_poffsets:
def __get__(self):
cdef np.ndarray[intptr_t, ndim=1] ar = np.empty((self.s[0].p_count,), dtype=np.intp) cdef np.ndarray[intptr_t, ndim=1] ar = np.empty((self.s[0].p_count,), dtype=np.intp)
cdef intptr_t[::1] ar_view = ar cdef intptr_t[::1] ar_view = ar
cdef intptr_t offset = 0 cdef intptr_t offset = 0
@ -487,7 +490,8 @@ cdef class ScatteringSystem:
offset += self.s[0].tm[self.s[0].p[pi].tmatrix_id].spec[0].n offset += self.s[0].tm[self.s[0].p[pi].tmatrix_id].spec[0].n
return ar return ar
def positions(self): property positions:
def __get__(self):
cdef np.ndarray[np.double_t, ndim=2] ar = np.empty((self.s[0].p_count, 3), dtype=float) cdef np.ndarray[np.double_t, ndim=2] ar = np.empty((self.s[0].p_count, 3), dtype=float)
cdef np.double_t[:,::1] ar_view = ar cdef np.double_t[:,::1] ar_view = ar
for pi in range(self.s[0].p_count): for pi in range(self.s[0].p_count):

View File

@ -31,7 +31,7 @@
#define SQ(x) ((x)*(x)) #define SQ(x) ((x)*(x))
#define QPMS_SCATSYS_LEN_RTOL 1e-13 #define QPMS_SCATSYS_LEN_RTOL 1e-13
#define QPMS_SCATSYS_TMATRIX_ATOL 1e-14 #define QPMS_SCATSYS_TMATRIX_ATOL 1e-12
#define QPMS_SCATSYS_TMATRIX_RTOL 1e-12 #define QPMS_SCATSYS_TMATRIX_RTOL 1e-12
long qpms_scatsystem_nthreads_default = 4; long qpms_scatsystem_nthreads_default = 4;