irot3 to uvswf matrix
Former-commit-id: cb59876dbdaae144913422b73a121cb48cfd9984
This commit is contained in:
parent
9785327445
commit
d4ae25ff81
|
@ -664,7 +664,7 @@ cdef class basespec:
|
||||||
if 'norm' in kwargs.keys():
|
if 'norm' in kwargs.keys():
|
||||||
self.s.norm = kwargs['norm']
|
self.s.norm = kwargs['norm']
|
||||||
else:
|
else:
|
||||||
self.s.norm = QPMS_NORMALISATION_UNDEF
|
self.s.norm = QPMS_NORMALISATION_POWER
|
||||||
# set the other metadata
|
# set the other metadata
|
||||||
cdef qpms_l_t l
|
cdef qpms_l_t l
|
||||||
cdef qpms_m_t m
|
cdef qpms_m_t m
|
||||||
|
@ -707,18 +707,27 @@ cdef class basespec:
|
||||||
def l(self): # ugly
|
def l(self): # ugly
|
||||||
return self.tlm()[1]
|
return self.tlm()[1]
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return self.s.n
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
# TODO raise correct errors (TypeError on bad type of key, IndexError on exceeding index)
|
||||||
|
return self.__ilist[key]
|
||||||
|
|
||||||
property ilist:
|
property ilist:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.__ilist
|
return self.__ilist
|
||||||
|
|
||||||
property rawpointer:
|
cdef qpms_vswf_set_spec_t *rawpointer(basespec self):
|
||||||
'''Pointer to the qpms_vswf_set_spec_t structure.
|
'''Pointer to the qpms_vswf_set_spec_t structure.
|
||||||
Don't forget to reference the basespec object itself!!!
|
Don't forget to reference the basespec object itself when storing the pointer anywhere!!!
|
||||||
'''
|
'''
|
||||||
|
return &(self.s)
|
||||||
|
|
||||||
|
property rawpointer:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return <uintptr_t> &(self.s)
|
return <uintptr_t> &(self.s)
|
||||||
|
|
||||||
|
|
||||||
# Quaternions from wigner.h
|
# Quaternions from wigner.h
|
||||||
# (mainly for testing; use moble's quaternions in python)
|
# (mainly for testing; use moble's quaternions in python)
|
||||||
|
|
||||||
|
@ -1002,6 +1011,17 @@ cdef class irot3:
|
||||||
r.rot = cquat(math.cos(math.pi/n),0,0,math.sin(math.pi/n))
|
r.rot = cquat(math.cos(math.pi/n),0,0,math.sin(math.pi/n))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def as_uvswf_matrix(irot3 self, basespec bspec):
|
||||||
|
'''
|
||||||
|
Returns the uvswf representation of the current transform as a numpy array
|
||||||
|
'''
|
||||||
|
cdef ssize_t sz = len(bspec)
|
||||||
|
cdef np.ndarray m = np.empty((sz, sz), dtype=complex, order='C') # FIXME explicit dtype
|
||||||
|
cdef cdouble[:, ::1] view = m
|
||||||
|
qpms_irot3_uvswfi_dense(&view[0,0], bspec.rawpointer(), self.qd)
|
||||||
|
return m
|
||||||
|
|
||||||
|
|
||||||
def tlm2uvswfi(t, l, m):
|
def tlm2uvswfi(t, l, m):
|
||||||
''' TODO doc
|
''' TODO doc
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -195,7 +195,7 @@ complex double *qpms_irot3_uvswfi_dense(
|
||||||
qpms_l_t cl;
|
qpms_l_t cl;
|
||||||
qpms_m_t cm;
|
qpms_m_t cm;
|
||||||
if(qpms_uvswfi2tmn(bspec->ilist[col], &ct, &cm, &cl)) abort();
|
if(qpms_uvswfi2tmn(bspec->ilist[col], &ct, &cm, &cl)) abort();
|
||||||
if (rl == cl && rm == cm && rt == ct)
|
if (rl == cl && rt == ct)
|
||||||
// TODO qpms_vswf_irot_elem_from_irot3 might be slow and not too accurate for large l
|
// TODO qpms_vswf_irot_elem_from_irot3 might be slow and not too accurate for large l
|
||||||
target[n*row + col] = // Checkme rm and cm order
|
target[n*row + col] = // Checkme rm and cm order
|
||||||
qpms_vswf_irot_elem_from_irot3(t,
|
qpms_vswf_irot_elem_from_irot3(t,
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -22,6 +22,7 @@ qpms_c = Extension('qpms_c',
|
||||||
'qpms/gaunt.c',#'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
|
'qpms/gaunt.c',#'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
|
||||||
# FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
|
# FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
|
||||||
'qpms/translations.c',
|
'qpms/translations.c',
|
||||||
|
'qpms/symmetries.c',
|
||||||
'qpms/wigner.c'],
|
'qpms/wigner.c'],
|
||||||
extra_compile_args=['-std=c99','-ggdb', '-O0',
|
extra_compile_args=['-std=c99','-ggdb', '-O0',
|
||||||
'-DQPMS_COMPILE_PYTHON_EXTENSIONS', # this is required
|
'-DQPMS_COMPILE_PYTHON_EXTENSIONS', # this is required
|
||||||
|
|
Loading…
Reference in New Issue