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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
# -*- coding: utf-8 -*-
###################################################################################
# Fits, Elastic constants fits : Alessandro Mirone
# European Synchrotron Radiation Facility
###################################################################################
#distutils: extra_compile_args = -fopenmp
# distutils: language = c++
from __future__ import print_function
import cython
import numpy
cimport numpy
from libc.stdio cimport printf
# pagbone_outputfile, threshold, maskbone_outputfile, myrank, nprocs, ncpus, MemPerProc
cdef extern from "segment.h":
cdef void segment(
char *,
float,
int,
char *,
int,
int,
int,
long int,
int , int , int ,int) nogil
cdef extern from "segment.h":
cdef void spilla ( char *,
char *,
char *,
float ,
char *,
int ,
int ,
int ,
long int ,
int , int , int ) nogil
cdef extern from "segment.h":
cdef void incolla ( char *,
char *,
char *,
char *,
int ,
int ,
int ,
long int ,
int , int , int ) nogil
@cython.boundscheck(False)
def pysegment( pagbone_outputfile_py,
float threshold,
int medianR,
maskbone_outputfile_py,
int myrank,
int nprocs,
int ncpus,
long int MemPerProc,
int SIZEZ, int SIZEY, int SIZEX, int dilatation) :
print (" NCPUS ", ncpus)
cdef bytes py_bytes = pagbone_outputfile_py.encode()
cdef char* pagbone_outputfile = py_bytes
cdef py_bytes2 = maskbone_outputfile_py.encode()
cdef char* maskbone_outputfile = py_bytes2
segment( pagbone_outputfile,
threshold,
medianR,
maskbone_outputfile,
myrank,
nprocs,
ncpus,
MemPerProc,
SIZEZ, SIZEY, SIZEX, dilatation)
@cython.boundscheck(False)
def pyspilla( pagbone_outputfile_py,
absbone_outputfile_py,
maskbone_outputfile_py,
float threshold,
corrbone_outputfile_py,
int myrank,
int nprocs,
int ncpus,
long int MemPerProc,
int SIZEZ, int SIZEY, int SIZEX) :
print( " NCPUS ", ncpus)
cdef bytes py_bytes0 = pagbone_outputfile_py.encode()
cdef char* pagbone_outputfile = py_bytes0
cdef bytes py_bytes = absbone_outputfile_py.encode()
cdef char* absbone_outputfile = py_bytes
print( " ------------ " )
print( absbone_outputfile_py)
print( " ------------ " )
printf(" %s \n", absbone_outputfile );
cdef py_bytes2 = maskbone_outputfile_py.encode()
cdef char* maskbone_outputfile = py_bytes2
cdef py_bytes3 = corrbone_outputfile_py.encode()
cdef char* corrbone_outputfile = py_bytes3
print( " ------------ " )
print( absbone_outputfile_py)
print( " ------------ " )
printf(" %s \n", absbone_outputfile );
spilla( pagbone_outputfile,
absbone_outputfile,
maskbone_outputfile,
threshold,
corrbone_outputfile,
myrank,
nprocs,
ncpus,
MemPerProc,
SIZEZ, SIZEY, SIZEX )
@cython.boundscheck(False)
def pyincolla( pagbone_outputfile_py,
maskbone_outputfile_py,
correctedvol_outputfile_py,
outputfile_py,
int myrank,
int nprocs,
int ncpus,
long int MemPerProc,
int SIZEZ, int SIZEY, int SIZEX) :
print( " NCPUS ", ncpus)
cdef bytes py_bytes = pagbone_outputfile_py.encode()
# cdef char* pagbone_outputfile_py = py_bytes
cdef char* pagbone_outputfile = py_bytes
cdef py_bytes2 = maskbone_outputfile_py.encode()
cdef char* maskbone_outputfile = py_bytes2
cdef py_bytes3 = correctedvol_outputfile_py.encode()
cdef char* correctedvol_outputfile = py_bytes3
cdef py_bytes4 = outputfile_py.encode()
cdef char* outputfile = py_bytes4
incolla( pagbone_outputfile,
maskbone_outputfile,
correctedvol_outputfile,
outputfile,
myrank,
nprocs,
ncpus,
MemPerProc,
SIZEZ, SIZEY, SIZEX )
|