PyObject *PyPSFExObject_center(struct PyPSFExObject *self, PyObject *args) { PyObject *retval = NULL; double row=0, col=0; double rowcen, colcen; int ndims=1; npy_intp dims[1]; double *data; if (!PyArg_ParseTuple(args, (char*)"dd", &row, &col)) { return NULL; } get_center(RECON_NROW(self->psfex), RECON_NCOL(self->psfex), row, col, self->psfex->pixstep, &rowcen, &colcen); dims[0] = 2; retval = PyArray_SimpleNew(ndims, dims, NPY_FLOAT64); data = (double *) PyArray_DATA(retval); data[0] = rowcen; data[1] = colcen; return retval; }
static PyObject *make_psf_image(const struct psfex *self) { PyObject *image=NULL; int ndims=2; npy_intp dims[2]; //dims[0] = PSFEX_NROW(self); //dims[1] = PSFEX_NCOL(self); dims[0] = RECON_NROW(self); dims[1] = RECON_NCOL(self); image = PyArray_ZEROS(ndims, dims, NPY_FLOAT64, 0); return image; }
double *psfex_recp(const struct psfex *self, double row, double col, long *nrow, long *ncol) { // this is the size of the reconstructed image (*nrow) = RECON_NROW(self); (*ncol) = RECON_NCOL(self); long npix=(*nrow)*(*ncol); double *data=calloc(npix, sizeof(double)); if (!data) { fprintf(stderr,"could not allocate %ld doubles\n", npix); exit(1); } _psfex_rec_fill(self, row, col, data); return data; }