-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpsr.hpp
116 lines (88 loc) · 2.5 KB
/
psr.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#pragma once
#include <complex>
/*
Complex types
*/
typedef std::complex<float> Complex32;
typedef std::complex<double> Complex64;
/*
Macro for 2*pi
*/
#define TPI (2*NPY_PI*Complex64(0,1))
/*
Dispersion constant in MHz^2 s / pc cm^-3
*/
#define DCONST (double) 4.148808e3
/*
Support Functions
*/
inline char* PyUnicode_AsString(PyObject *ob) {
PyObject *enc;
char *cstr;
enc = PyUnicode_AsEncodedString(ob, "utf-8", "Error");
if( enc == NULL ) {
PyErr_Format(PyExc_ValueError, "Cannot encode string");
return NULL;
}
cstr = PyBytes_AsString(enc);
Py_XDECREF(enc);
return cstr;
}
// fft.c
void read_wisdom(char*, PyObject*);
// utils.c
extern PyObject *BindToCore(PyObject*, PyObject*, PyObject*);
extern char BindToCore_doc[];
extern PyObject *BindOpenMPToCores(PyObject*, PyObject*, PyObject*);
extern char BindOpenMPToCores_doc[];
/*
Complex magnitude squared functions
*/
template<typename T>
inline T abs2(std::complex<T> z) {
return z.real()*z.real() + z.imag()*z.imag();
}
/*
FFT Functions
*/
// fft.c
extern PyObject *PulsarEngineRaw(PyObject*, PyObject*, PyObject*);
extern char PulsarEngineRaw_doc[];
extern PyObject *PulsarEngineRawWindow(PyObject*, PyObject*, PyObject*);
extern char PulsarEngineRawWindow_doc[];
extern PyObject *PhaseRotator(PyObject*, PyObject*, PyObject*);
extern char PhaseRotator_doc[];
/*
Spectral Kurtosis (RFI Flagging) Functions
*/
// kurtosis.c
extern PyObject *ComputeSKMask(PyObject*, PyObject*, PyObject*);
extern char ComputeSKMask_doc[];
extern PyObject *ComputePseudoSKMask(PyObject*, PyObject*, PyObject*);
extern char ComputePseudoSKMask_doc[];
/*
Coherent Dedispersion
*/
// dedispersion.c
extern PyObject *MultiChannelCD(PyObject*, PyObject*, PyObject*);
extern char MultiChannelCD_doc[];
/*
Reduction Functions
*/
// reduce.c
extern PyObject *CombineToIntensity(PyObject*, PyObject*, PyObject*);
extern char CombineToIntensity_doc[];
extern PyObject *CombineToLinear(PyObject*, PyObject*, PyObject*);
extern char CombineToLinear_doc[];
extern PyObject *CombineToCircular(PyObject*, PyObject*, PyObject*);
extern char CombineToCircular_doc[];
extern PyObject *CombineToStokes(PyObject*, PyObject*, PyObject*);
extern char CombineToStokes_doc[];
/*
Quantizing Functions
*/
// quantize.c
extern PyObject *OptimizeDataLevels8Bit(PyObject*, PyObject*, PyObject*);
extern char OptimizeDataLevels8Bit_doc[];
extern PyObject *OptimizeDataLevels4Bit(PyObject*, PyObject*, PyObject*);
extern char OptimizeDataLevels4Bit_doc[];