Generated by Cython 0.16.beta0 on Fri Apr 20 09:46:40 2012
Raw output: mar345_IO.c
1: """
/* "mar345_IO.pyx":1 * """ #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* New Cython version of mar345_io for preparing the migration to Python3 * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2: New Cython version of mar345_io for preparing the migration to Python3
3:
4: Compressor & decompressor for "pack" algorithm by JPA, binding to CCP4 libraries
5:
6: Warning: decompressor is just a cython porting of mar345_io, but in cython so (soon) python3 compliant.
7:
8: Future: make those algorithm actually generate strings not go via files;
9: it will allow a broader use of the algorithm.
10:
11: """
12:
13: __authors__ = ["Jerome Kieffer", "Gael Goret"]
/* "mar345_IO.pyx":13 * """ * * __authors__ = ["Jerome Kieffer", "Gael Goret"] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* __contact__ = "jerome.kieffer@esrf.eu" * __license__ = "LGPLv3+" */ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_kp_s_26)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_26)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_27)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____authors__, ((PyObject *)__pyx_t_1))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
14: __contact__ = "jerome.kieffer@esrf.eu"
/* "mar345_IO.pyx":14 * * __authors__ = ["Jerome Kieffer", "Gael Goret"] * __contact__ = "jerome.kieffer@esrf.eu" #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* __license__ = "LGPLv3+" * __copyright__ = "2012, European Synchrotron Radiation Facility, Grenoble, France" */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_28))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15: __license__ = "LGPLv3+"
/* "mar345_IO.pyx":15 * __authors__ = ["Jerome Kieffer", "Gael Goret"] * __contact__ = "jerome.kieffer@esrf.eu" * __license__ = "LGPLv3+" #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* __copyright__ = "2012, European Synchrotron Radiation Facility, Grenoble, France" * */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_29))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16: __copyright__ = "2012, European Synchrotron Radiation Facility, Grenoble, France"
/* "mar345_IO.pyx":16 * __contact__ = "jerome.kieffer@esrf.eu" * __license__ = "LGPLv3+" * __copyright__ = "2012, European Synchrotron Radiation Facility, Grenoble, France" #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * import cython */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_30))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17:
18: import cython
19: cimport numpy
20: import numpy
/* "mar345_IO.pyx":20 * import cython * cimport numpy * import numpy #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* import os,tempfile * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21: import os,tempfile
/* "mar345_IO.pyx":21 * cimport numpy * import numpy * import os,tempfile #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * #cdef extern from "pack_c.h": */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22:
23: #cdef extern from "pack_c.h":
24: # void pack_wordimage_c(short int*, int , int , char*) nogil
25: # void unpack_word(FILE *packfile, int x, int y, short int *img) nogil
26:
27: cdef extern from "ccp4_pack.h":
28: void* mar345_read_data_string(char *instream, int ocount, int dim1, int dim2) nogil
29: void pack_wordimage_c(short int*, int , int , char*) nogil
30:
31: @cython.boundscheck(False)
32: def compress_pck(numpy.ndarray inputArray not None):
/* "mar345_IO.pyx":32 * * @cython.boundscheck(False) * def compress_pck(numpy.ndarray inputArray not None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * @param inputArray: numpy array as input */ static PyObject *__pyx_pf_9mar345_IO_compress_pck(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_inputArray) { CYTHON_UNUSED long __pyx_v_size; int __pyx_v_dim0; int __pyx_v_dim1; int __pyx_v_fd; char *__pyx_v_name; PyArrayObject *__pyx_v_data = 0; short *__pyx_v_cdata; PyObject *__pyx_v_fname = NULL; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_output = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_data; __Pyx_Buffer __pyx_pybuffer_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compress_pck", 0); __pyx_pybuffer_data.pybuffer.buf = NULL; __pyx_pybuffer_data.refcount = 0; __pyx_pybuffernd_data.data = NULL; __pyx_pybuffernd_data.rcbuffer = &__pyx_pybuffer_data; /* "mar345_IO.pyx":32 * * @cython.boundscheck(False) * def compress_pck(numpy.ndarray inputArray not None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * @param inputArray: numpy array as input */ __pyx_k_tuple_31 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_31); __Pyx_INCREF(((PyObject *)__pyx_n_s__inputArray)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__inputArray)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inputArray)); __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 1, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dim0)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 2, ((PyObject *)__pyx_n_s__dim0)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim0)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dim1)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 3, ((PyObject *)__pyx_n_s__dim1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 4, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 5, ((PyObject *)__pyx_n_s__j)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fd)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 6, ((PyObject *)__pyx_n_s__fd)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd)); __Pyx_INCREF(((PyObject *)__pyx_n_s__ret)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 7, ((PyObject *)__pyx_n_s__ret)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ret)); __Pyx_INCREF(((PyObject *)__pyx_n_s__name)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 8, ((PyObject *)__pyx_n_s__name)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__name)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 9, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 10, ((PyObject *)__pyx_n_s__cdata)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata)); __Pyx_INCREF(((PyObject *)__pyx_n_s__fname)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 11, ((PyObject *)__pyx_n_s__fname)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fname)); __Pyx_INCREF(((PyObject *)__pyx_n_s__f)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 12, ((PyObject *)__pyx_n_s__f)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f)); __Pyx_INCREF(((PyObject *)__pyx_n_s__output)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 13, ((PyObject *)__pyx_n_s__output)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); /* "mar345_IO.pyx":32 * * @cython.boundscheck(False) * def compress_pck(numpy.ndarray inputArray not None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * @param inputArray: numpy array as input */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9mar345_IO_1compress_pck, NULL, __pyx_n_s__mar345_IO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__compress_pck, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(1, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__compress_pck, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33: """
34: @param inputArray: numpy array as input
35: @param filename: file to write data to
36: """
37: cdef long size = inputArray.size
/* "mar345_IO.pyx":37 * @param filename: file to write data to * """ * cdef long size = inputArray.size #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef int dim0, dim1, i, j, fd, ret * cdef char* name */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_inputArray), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_2;
38: cdef int dim0, dim1, i, j, fd, ret
39: cdef char* name
40: assert inputArray.ndim == 2, "shape is 2D"
/* "mar345_IO.pyx":40 * cdef int dim0, dim1, i, j, fd, ret * cdef char* name * assert inputArray.ndim == 2, "shape is 2D" #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dim0 = inputArray.shape[0] * dim1 = inputArray.shape[1] */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_inputArray->nd == 2))) { PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_1)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif
41: dim0 = inputArray.shape[0]
/* "mar345_IO.pyx":41 * cdef char* name * assert inputArray.ndim == 2, "shape is 2D" * dim0 = inputArray.shape[0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* dim1 = inputArray.shape[1] * cdef numpy.ndarray[numpy.uint16_t, ndim = 1] data = numpy.ascontiguousarray(inputArray.astype(numpy.uint16).ravel(), dtype=numpy.uint16) */ __pyx_v_dim0 = (__pyx_v_inputArray->dimensions[0]);
42: dim1 = inputArray.shape[1]
/* "mar345_IO.pyx":42 * assert inputArray.ndim == 2, "shape is 2D" * dim0 = inputArray.shape[0] * dim1 = inputArray.shape[1] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef numpy.ndarray[numpy.uint16_t, ndim = 1] data = numpy.ascontiguousarray(inputArray.astype(numpy.uint16).ravel(), dtype=numpy.uint16) * cdef short int * cdata */ __pyx_v_dim1 = (__pyx_v_inputArray->dimensions[1]);
43: cdef numpy.ndarray[numpy.uint16_t, ndim = 1] data = numpy.ascontiguousarray(inputArray.astype(numpy.uint16).ravel(), dtype=numpy.uint16)
/* "mar345_IO.pyx":43 * dim0 = inputArray.shape[0] * dim1 = inputArray.shape[1] * cdef numpy.ndarray[numpy.uint16_t, ndim = 1] data = numpy.ascontiguousarray(inputArray.astype(numpy.uint16).ravel(), dtype=numpy.uint16) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef short int * cdata * cdata =<
short int *> data.data */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_inputArray), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint16); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint16_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_data.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_data.diminfo[0].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data.diminfo[0].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_7 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0;
44: cdef short int * cdata
45: cdata = < short int *> data.data
/* "mar345_IO.pyx":45 * cdef numpy.ndarray[numpy.uint16_t, ndim = 1] data = numpy.ascontiguousarray(inputArray.astype(numpy.uint16).ravel(), dtype=numpy.uint16) * cdef short int * cdata * cdata =<
short int *> data.data #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* (fd,fname) = tempfile.mkstemp() * name =<
char*> fname */ __pyx_v_cdata = ((short *)__pyx_v_data->data);
46: (fd,fname) = tempfile.mkstemp()
/* "mar345_IO.pyx":46 * cdef short int * cdata * cdata =<
short int *> data.data * (fd,fname) = tempfile.mkstemp() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* name =<
char*> fname * with nogil: */ __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; #if CYTHON_COMPILING_IN_CPYTHON if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { PyObject* sequence = __pyx_t_6; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_4); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = PyList_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { Py_ssize_t index = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = NULL; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L4_unpacking_done:; } __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_fd = __pyx_t_9; __pyx_v_fname = __pyx_t_4; __pyx_t_4 = 0;
47: name = <char*> fname
/* "mar345_IO.pyx":47 * cdata =<
short int *> data.data * (fd,fname) = tempfile.mkstemp() * name =<
char*> fname #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* with nogil: * pack_wordimage_c(cdata, dim1, dim0, name) */ __pyx_t_10 = PyBytes_AsString(__pyx_v_fname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_name = ((char *)__pyx_t_10);
48: with nogil:
/* "mar345_IO.pyx":48 * (fd,fname) = tempfile.mkstemp() * name =<
char*> fname * with nogil: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mar345_IO.pyx":48 * (fd,fname) = tempfile.mkstemp() * name =<
char*> fname * with nogil: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: */ /*finally:*/ { Py_BLOCK_THREADS } }
49: pack_wordimage_c(cdata, dim1, dim0, name)
/* "mar345_IO.pyx":49 * name =<
char*> fname * with nogil: * pack_wordimage_c(cdata, dim1, dim0, name) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* with open(name,"rb") as f: * f.seek(0) */ pack_wordimage_c(__pyx_v_cdata, __pyx_v_dim1, __pyx_v_dim0, __pyx_v_name); }
50: with open(name,"rb") as f:
/* "mar345_IO.pyx":50 * with nogil: * pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* f.seek(0) * output = f.read() */ /*with:*/ { __pyx_t_6 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__rb)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb)); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_11 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s____exit__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { __Pyx_INCREF(__pyx_t_5); __pyx_v_f = __pyx_t_5; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "mar345_IO.pyx":50 * with nogil: * pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* f.seek(0) * output = f.read() */ /*except:*/ { __Pyx_AddTraceback("mar345_IO.compress_pck", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_4)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_16 = PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} __Pyx_GOTREF(__pyx_t_16); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_16); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; if (unlikely(__pyx_t_15<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} __pyx_t_17 = (!__pyx_t_15); if (__pyx_t_17) { __Pyx_GIVEREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;} goto __pyx_L23; } __pyx_L23:; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L13_exception_handled; } __pyx_L14_except_error:; __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); goto __pyx_L1_error; __pyx_L13_exception_handled:; __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_L19_try_end:; } } /*finally:*/ { if (__pyx_t_11) { __pyx_t_14 = PyObject_Call(__pyx_t_11, __pyx_k_tuple_3, NULL); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(__pyx_t_17<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } goto __pyx_L24; __pyx_L8_error:; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L1_error; __pyx_L24:; } /* "mar345_IO.pyx":50 * with nogil: * pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* f.seek(0) * output = f.read() */ __pyx_k_tuple_3 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_3, 1, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_3, 2, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
51: f.seek(0)
/* "mar345_IO.pyx":51 * pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: * f.seek(0) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* output = f.read() * os.close(fd) */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L12_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L12_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "mar345_IO.pyx":51 * pack_wordimage_c(cdata, dim1, dim0, name) * with open(name,"rb") as f: * f.seek(0) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* output = f.read() * os.close(fd) */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
52: output = f.read()
/* "mar345_IO.pyx":52 * with open(name,"rb") as f: * f.seek(0) * output = f.read() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* os.close(fd) * os.remove(name) */ __pyx_t_6 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__read); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L12_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L12_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_output = __pyx_t_5; __pyx_t_5 = 0; } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L19_try_end; __pyx_L12_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
53: os.close(fd)
/* "mar345_IO.pyx":53 * f.seek(0) * output = f.read() * os.close(fd) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* os.remove(name) * return output */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__close); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_fd); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
54: os.remove(name)
/* "mar345_IO.pyx":54 * output = f.read() * os.close(fd) * os.remove(name) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return output * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__remove); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
55: return output
/* "mar345_IO.pyx":55 * os.close(fd) * os.remove(name) * return output #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_output)) { __Pyx_RaiseUnboundLocalError("output"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_INCREF(__pyx_v_output); __pyx_r = __pyx_v_output; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("mar345_IO.compress_pck", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF(__pyx_v_fname); __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_output); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_9mar345_IO_3uncompress_pck(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9mar345_IO_2uncompress_pck[] = "\n Unpack a mar345 compressed image\n \n @param raw: input string (bytes in python3)\n @param dim1,dim2: optional parameters size\n @param overflowPix: optional parameters: number of overflowed pixels \n \n @return : ndarray of 2D with the right size\n "; static PyMethodDef __pyx_mdef_9mar345_IO_3uncompress_pck = {__Pyx_NAMESTR("uncompress_pck"), (PyCFunction)__pyx_pw_9mar345_IO_3uncompress_pck, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9mar345_IO_2uncompress_pck)}; static PyObject *__pyx_pw_9mar345_IO_3uncompress_pck(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_raw = 0; PyObject *__pyx_v_dim1 = 0; PyObject *__pyx_v_dim2 = 0; PyObject *__pyx_v_overflowPix = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__raw,&__pyx_n_s__dim1,&__pyx_n_s__dim2,&__pyx_n_s__overflowPix,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("uncompress_pck (wrapper)", 0); __pyx_self = __pyx_self; { PyObject* values[4] = {0,0,0,0};
56:
57: @cython.boundscheck(False)
58: def uncompress_pck(raw not None, dim1=None, dim2=None, overflowPix=None):
/* "mar345_IO.pyx":58 * * @cython.boundscheck(False) * def uncompress_pck(raw not None, dim1=None, dim2=None, overflowPix=None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Unpack a mar345 compressed image */ values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__raw); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim1); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim2); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__overflowPix); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uncompress_pck")<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_raw = values[0]; __pyx_v_dim1 = values[1]; __pyx_v_dim2 = values[2]; __pyx_v_overflowPix = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("uncompress_pck", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("mar345_IO.uncompress_pck", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(((PyObject *)__pyx_v_raw) == Py_None)) { PyErr_Format(PyExc_TypeError, "Argument 'raw' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_r = __pyx_pf_9mar345_IO_2uncompress_pck(__pyx_self, __pyx_v_raw, __pyx_v_dim1, __pyx_v_dim2, __pyx_v_overflowPix); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9mar345_IO_2uncompress_pck(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_raw, PyObject *__pyx_v_dim1, PyObject *__pyx_v_dim2, PyObject *__pyx_v_overflowPix) { int __pyx_v_cdim1; int __pyx_v_cdim2; int __pyx_v_chigh; PyObject *__pyx_v_end = NULL; PyObject *__pyx_v_key1 = NULL; PyObject *__pyx_v_key2 = NULL; PyObject *__pyx_v_start = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_sizes = NULL; PyObject *__pyx_v_hiLine = NULL; PyObject *__pyx_v_word = NULL; PyArrayObject *__pyx_v_data = 0; char *__pyx_v_instream; __Pyx_LocalBuf_ND __pyx_pybuffernd_data; __Pyx_Buffer __pyx_pybuffer_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("uncompress_pck", 0); __Pyx_INCREF(__pyx_v_raw); __pyx_pybuffer_data.pybuffer.buf = NULL; __pyx_pybuffer_data.refcount = 0; __pyx_pybuffernd_data.data = NULL; __pyx_pybuffernd_data.rcbuffer = &__pyx_pybuffer_data; /* "mar345_IO.pyx":58 * * @cython.boundscheck(False) * def uncompress_pck(raw not None, dim1=None, dim2=None, overflowPix=None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Unpack a mar345 compressed image */ __pyx_k_tuple_34 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(((PyObject *)__pyx_n_s__raw)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__raw)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__raw)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dim1)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__dim1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__dim2)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, ((PyObject *)__pyx_n_s__dim2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__overflowPix)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, ((PyObject *)__pyx_n_s__overflowPix)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__overflowPix)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdim1)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 4, ((PyObject *)__pyx_n_s__cdim1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdim1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__cdim2)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 5, ((PyObject *)__pyx_n_s__cdim2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdim2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__chigh)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 6, ((PyObject *)__pyx_n_s__chigh)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chigh)); __Pyx_INCREF(((PyObject *)__pyx_n_s__end)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 7, ((PyObject *)__pyx_n_s__end)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end)); __Pyx_INCREF(((PyObject *)__pyx_n_s__key1)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 8, ((PyObject *)__pyx_n_s__key1)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key1)); __Pyx_INCREF(((PyObject *)__pyx_n_s__key2)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 9, ((PyObject *)__pyx_n_s__key2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key2)); __Pyx_INCREF(((PyObject *)__pyx_n_s__start)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 10, ((PyObject *)__pyx_n_s__start)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start)); __Pyx_INCREF(((PyObject *)__pyx_n_s__key)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 11, ((PyObject *)__pyx_n_s__key)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key)); __Pyx_INCREF(((PyObject *)__pyx_n_s__sizes)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 12, ((PyObject *)__pyx_n_s__sizes)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sizes)); __Pyx_INCREF(((PyObject *)__pyx_n_s__hiLine)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 13, ((PyObject *)__pyx_n_s__hiLine)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hiLine)); __Pyx_INCREF(((PyObject *)__pyx_n_s__word)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 14, ((PyObject *)__pyx_n_s__word)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__word)); __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 15, ((PyObject *)__pyx_n_s__data)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); __Pyx_INCREF(((PyObject *)__pyx_n_s__instream)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 16, ((PyObject *)__pyx_n_s__instream)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__instream)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); /* "mar345_IO.pyx":58 * * @cython.boundscheck(False) * def uncompress_pck(raw not None, dim1=None, dim2=None, overflowPix=None): #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* """ * Unpack a mar345 compressed image */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9mar345_IO_3uncompress_pck, NULL, __pyx_n_s__mar345_IO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__uncompress_pck, __pyx_t_1)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
59: """
60: Unpack a mar345 compressed image
61:
62: @param raw: input string (bytes in python3)
63: @param dim1,dim2: optional parameters size
64: @param overflowPix: optional parameters: number of overflowed pixels
65:
66: @return : ndarray of 2D with the right size
67: """
68: cdef int cdim1, cdim2, chigh
69: end=None
/* "mar345_IO.pyx":69 * """ * cdef int cdim1, cdim2, chigh * end=None #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if dim1 is None or dim2 is None: * key1 = "CCP4 packed image, X: " */ __Pyx_INCREF(Py_None); __pyx_v_end = Py_None;
70: if dim1 is None or dim2 is None:
/* "mar345_IO.pyx":70 * cdef int cdim1, cdim2, chigh * end=None * if dim1 is None or dim2 is None: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* key1 = "CCP4 packed image, X: " * key2 = "CCP4 packed image V2, X: " */ __pyx_t_1 = (__pyx_v_dim1 == Py_None); if (!__pyx_t_1) { __pyx_t_2 = (__pyx_v_dim2 == Py_None); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) {
71: key1 = "CCP4 packed image, X: "
/* "mar345_IO.pyx":71 * end=None * if dim1 is None or dim2 is None: * key1 = "CCP4 packed image, X: " #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* key2 = "CCP4 packed image V2, X: " * start = raw.find(key2) */ __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); __pyx_v_key1 = ((PyObject *)__pyx_kp_s_4);
72: key2 = "CCP4 packed image V2, X: "
/* "mar345_IO.pyx":72 * if dim1 is None or dim2 is None: * key1 = "CCP4 packed image, X: " * key2 = "CCP4 packed image V2, X: " #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* start = raw.find(key2) * key = key2 */ __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); __pyx_v_key2 = ((PyObject *)__pyx_kp_s_5);
73: start = raw.find(key2)
/* "mar345_IO.pyx":73 * key1 = "CCP4 packed image, X: " * key2 = "CCP4 packed image V2, X: " * start = raw.find(key2) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* key = key2 * if start == -1: */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_raw, __pyx_n_s__find); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_key2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key2); __Pyx_GIVEREF(__pyx_v_key2); __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_start = __pyx_t_6; __pyx_t_6 = 0;
74: key = key2
/* "mar345_IO.pyx":74 * key2 = "CCP4 packed image V2, X: " * start = raw.find(key2) * key = key2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if start == -1: * start = raw.find(key1) */ __Pyx_INCREF(__pyx_v_key2); __pyx_v_key = __pyx_v_key2;
75: if start == -1:
/* "mar345_IO.pyx":75 * start = raw.find(key2) * key = key2 * if start == -1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* start = raw.find(key1) * key = key1 */ __pyx_t_6 = PyObject_RichCompare(__pyx_v_start, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) {
76: start = raw.find(key1)
/* "mar345_IO.pyx":76 * key = key2 * if start == -1: * start = raw.find(key1) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* key = key1 * start = raw.index(key) + len(key) */ __pyx_t_6 = PyObject_GetAttr(__pyx_v_raw, __pyx_n_s__find); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_key1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key1); __Pyx_GIVEREF(__pyx_v_key1); __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_start); __pyx_v_start = __pyx_t_4; __pyx_t_4 = 0;
77: key = key1
/* "mar345_IO.pyx":77 * if start == -1: * start = raw.find(key1) * key = key1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* start = raw.index(key) + len(key) * sizes = raw[start:start + 13] */ __Pyx_INCREF(__pyx_v_key1); __Pyx_DECREF(__pyx_v_key); __pyx_v_key = __pyx_v_key1; goto __pyx_L4; } __pyx_L4:;
78: start = raw.index(key) + len(key)
/* "mar345_IO.pyx":78 * start = raw.find(key1) * key = key1 * start = raw.index(key) + len(key) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* sizes = raw[start:start + 13] * cdim1 =<
int > int(sizes[:4]) */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_raw, __pyx_n_s__index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_7 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_start); __pyx_v_start = __pyx_t_4; __pyx_t_4 = 0;
79: sizes = raw[start:start + 13]
/* "mar345_IO.pyx":79 * key = key1 * start = raw.index(key) + len(key) * sizes = raw[start:start + 13] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdim1 =<
int > int(sizes[:4]) * cdim2 =<
int > int(sizes[-4:]) */ __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyNumber_Add(__pyx_v_start, __pyx_int_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_raw, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_sizes = __pyx_t_4; __pyx_t_4 = 0;
80: cdim1 = < int > int(sizes[:4])
/* "mar345_IO.pyx":80 * start = raw.index(key) + len(key) * sizes = raw[start:start + 13] * cdim1 =<
int > int(sizes[:4]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdim2 =<
int > int(sizes[-4:]) * else: */ __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_sizes, 0, 4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_cdim1 = ((int)__pyx_t_9);
81: cdim2 = < int > int(sizes[-4:])
/* "mar345_IO.pyx":81 * sizes = raw[start:start + 13] * cdim1 =<
int > int(sizes[:4]) * cdim2 =<
int > int(sizes[-4:]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* else: * cdim1 =<
int > dim1 */ __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_sizes, -4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_cdim2 = ((int)__pyx_t_9); goto __pyx_L3; } /*else*/ {
82: else:
83: cdim1 = < int > dim1
/* "mar345_IO.pyx":83 * cdim2 =<
int > int(sizes[-4:]) * else: * cdim1 =<
int > dim1 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdim2 =<
int > dim2 * if overflowPix is None: */ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_dim1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_cdim1 = ((int)__pyx_t_9);
84: cdim2 = < int > dim2
/* "mar345_IO.pyx":84 * else: * cdim1 =<
int > dim1 * cdim2 =<
int > dim2 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if overflowPix is None: * end = raw.find("END OF HEADER") */ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_dim2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_cdim2 = ((int)__pyx_t_9); } __pyx_L3:;
85: if overflowPix is None:
/* "mar345_IO.pyx":85 * cdim1 =<
int > dim1 * cdim2 =<
int > dim2 * if overflowPix is None: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* end = raw.find("END OF HEADER") * start = raw[:end].find("HIGH") */ __pyx_t_3 = (__pyx_v_overflowPix == Py_None); if (__pyx_t_3) {
86: end = raw.find("END OF HEADER")
/* "mar345_IO.pyx":86 * cdim2 =<
int > dim2 * if overflowPix is None: * end = raw.find("END OF HEADER") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* start = raw[:end].find("HIGH") * hiLine = raw[start:end] */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_raw, __pyx_n_s__find); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_end); __pyx_v_end = __pyx_t_5; __pyx_t_5 = 0; /* "mar345_IO.pyx":86 * cdim2 =<
int > dim2 * if overflowPix is None: * end = raw.find("END OF HEADER") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* start = raw[:end].find("HIGH") * hiLine = raw[start:end] */ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
87: start = raw[:end].find("HIGH")
/* "mar345_IO.pyx":87 * if overflowPix is None: * end = raw.find("END OF HEADER") * start = raw[:end].find("HIGH") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hiLine = raw[start:end] * hiLine = hiLine.split("\n")[0] */ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_end); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_raw, 0, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__find); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_v_start); __pyx_v_start = __pyx_t_5; __pyx_t_5 = 0; /* "mar345_IO.pyx":87 * if overflowPix is None: * end = raw.find("END OF HEADER") * start = raw[:end].find("HIGH") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hiLine = raw[start:end] * hiLine = hiLine.split("\n")[0] */ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_n_s__HIGH)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_s__HIGH)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HIGH)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
88: hiLine = raw[start:end]
/* "mar345_IO.pyx":88 * end = raw.find("END OF HEADER") * start = raw[:end].find("HIGH") * hiLine = raw[start:end] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* hiLine = hiLine.split("\n")[0] * word = hiLine.split() */ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_start); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_end); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_raw, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_v_hiLine = __pyx_t_5; __pyx_t_5 = 0;
89: hiLine = hiLine.split("\n")[0]
/* "mar345_IO.pyx":89 * start = raw[:end].find("HIGH") * hiLine = raw[start:end] * hiLine = hiLine.split("\n")[0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* word = hiLine.split() * if len(word) > 1: */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_hiLine, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_hiLine); __pyx_v_hiLine = __pyx_t_5; __pyx_t_5 = 0; /* "mar345_IO.pyx":89 * start = raw[:end].find("HIGH") * hiLine = raw[start:end] * hiLine = hiLine.split("\n")[0] #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* word = hiLine.split() * if len(word) > 1: */ __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
90: word = hiLine.split()
/* "mar345_IO.pyx":90 * hiLine = raw[start:end] * hiLine = hiLine.split("\n")[0] * word = hiLine.split() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if len(word) > 1: * chigh = int(word[1]) */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_hiLine, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0;
91: if len(word) > 1:
/* "mar345_IO.pyx":91 * hiLine = hiLine.split("\n")[0] * word = hiLine.split() * if len(word) > 1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* chigh = int(word[1]) * else: */ __pyx_t_7 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (__pyx_t_7 > 1); if (__pyx_t_3) {
92: chigh = int(word[1])
/* "mar345_IO.pyx":92 * word = hiLine.split() * if len(word) > 1: * chigh = int(word[1]) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* else: * print("Error while looking for overflowed pixels in line %s" % hiLine.strip()) */ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_word, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_chigh = __pyx_t_9; goto __pyx_L6; } /*else*/ {
93: else:
94: print("Error while looking for overflowed pixels in line %s" % hiLine.strip())
/* "mar345_IO.pyx":94 * chigh = int(word[1]) * else: * print("Error while looking for overflowed pixels in line %s" % hiLine.strip()) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* chigh = 0 * else: */ __pyx_t_4 = PyObject_GetAttr(__pyx_v_hiLine, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_4))<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
95: chigh = 0
/* "mar345_IO.pyx":95 * else: * print("Error while looking for overflowed pixels in line %s" % hiLine.strip()) * chigh = 0 #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* else: * chigh =<
int > overflowPix */ __pyx_v_chigh = 0; } __pyx_L6:; goto __pyx_L5; } /*else*/ {
96: else:
97: chigh = < int > overflowPix
/* "mar345_IO.pyx":97 * chigh = 0 * else: * chigh =<
int > overflowPix #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32) * if not end: */ __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_overflowPix); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_chigh = ((int)__pyx_t_9); } __pyx_L5:;
98: cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32)
/* "mar345_IO.pyx":98 * else: * chigh =<
int > overflowPix * cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if not end: * end = raw.find("END OF HEADER") */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_cdim2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_cdim1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11)<
0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_11); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_data.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_data.diminfo[0].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data.diminfo[0].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data.diminfo[1].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data.diminfo[1].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[1]; } } __pyx_t_12 = 0; __pyx_v_data = ((PyArrayObject *)__pyx_t_11); __pyx_t_11 = 0;
99: if not end:
/* "mar345_IO.pyx":99 * chigh =<
int > overflowPix * cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32) * if not end: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* end = raw.find("END OF HEADER") * if end !=-1: */ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_end); if (unlikely(__pyx_t_3<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (!__pyx_t_3); if (__pyx_t_1) {
100: end = raw.find("END OF HEADER")
/* "mar345_IO.pyx":100 * cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32) * if not end: * end = raw.find("END OF HEADER") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if end !=-1: * raw = raw[end+14:].lstrip() */ __pyx_t_11 = PyObject_GetAttr(__pyx_v_raw, __pyx_n_s__find); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_v_end); __pyx_v_end = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L7; } __pyx_L7:; /* "mar345_IO.pyx":100 * cdef numpy.ndarray[numpy.uint32_t, ndim = 2] data = numpy.zeros((cdim2, cdim1), dtype=numpy.uint32) * if not end: * end = raw.find("END OF HEADER") #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* if end !=-1: * raw = raw[end+14:].lstrip() */ __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
101: if end !=-1:
/* "mar345_IO.pyx":101 * if not end: * end = raw.find("END OF HEADER") * if end !=-1: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* raw = raw[end+14:].lstrip() * cdef char* instream =<
char*> raw */ __pyx_t_10 = PyObject_RichCompare(__pyx_v_end, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1<
0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_1) {
102: raw = raw[end+14:].lstrip()
/* "mar345_IO.pyx":102 * end = raw.find("END OF HEADER") * if end !=-1: * raw = raw[end+14:].lstrip() #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* cdef char* instream =<
char*> raw * with nogil: */ __pyx_t_10 = PyNumber_Add(__pyx_v_end, __pyx_int_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_raw, __pyx_t_7, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__lstrip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_v_raw); __pyx_v_raw = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L8; } __pyx_L8:;
103: cdef char* instream = <char*> raw
/* "mar345_IO.pyx":103 * if end !=-1: * raw = raw[end+14:].lstrip() * cdef char* instream =<
char*> raw #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* with nogil: * data.data =<
char *> mar345_read_data_string(instream, chigh, cdim1, cdim2) */ __pyx_t_13 = PyBytes_AsString(__pyx_v_raw); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_instream = ((char *)__pyx_t_13);
104: with nogil:
/* "mar345_IO.pyx":104 * raw = raw[end+14:].lstrip() * cdef char* instream =<
char*> raw * with nogil: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* data.data =<
char *> mar345_read_data_string(instream, chigh, cdim1, cdim2) * return data */ { #ifdef WITH_THREAD PyThreadState *_save = NULL; #endif Py_UNBLOCK_THREADS /*try:*/ { /* "mar345_IO.pyx":104 * raw = raw[end+14:].lstrip() * cdef char* instream =<
char*> raw * with nogil: #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* data.data =<
char *> mar345_read_data_string(instream, chigh, cdim1, cdim2) * return data */ /*finally:*/ { Py_BLOCK_THREADS } }
105: data.data = <char *> mar345_read_data_string(instream, chigh, cdim1, cdim2)
/* "mar345_IO.pyx":105 * cdef char* instream =<
char*> raw * with nogil: * data.data =<
char *> mar345_read_data_string(instream, chigh, cdim1, cdim2) #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* return data * */ __pyx_v_data->data = ((char *)mar345_read_data_string(__pyx_v_instream, __pyx_v_chigh, __pyx_v_cdim1, __pyx_v_cdim2)); }
106: return data
/* "mar345_IO.pyx":106 * with nogil: * data.data =<
char *> mar345_read_data_string(instream, chigh, cdim1, cdim2) * return data #<
<
<
<
<
<
<
<
<
<
<
<
<
<
* */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_data)); __pyx_r = ((PyObject *)__pyx_v_data); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("mar345_IO.uncompress_pck", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_end); __Pyx_XDECREF(__pyx_v_key1); __Pyx_XDECREF(__pyx_v_key2); __Pyx_XDECREF(__pyx_v_start); __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_sizes); __Pyx_XDECREF(__pyx_v_hiLine); __Pyx_XDECREF(__pyx_v_word); __Pyx_XDECREF((PyObject *)__pyx_v_data); __Pyx_XDECREF(__pyx_v_raw); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; }
107: