You can subscribe to this list here.
2005 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}

_{Aug}
(1) 
_{Sep}

_{Oct}
(11) 
_{Nov}
(184) 
_{Dec}
(182) 

2006 
_{Jan}
(224) 
_{Feb}
(404) 
_{Mar}
(244) 
_{Apr}
(232) 
_{May}
(162) 
_{Jun}
(193) 
_{Jul}
(174) 
_{Aug}
(161) 
_{Sep}
(170) 
_{Oct}
(283) 
_{Nov}
(310) 
_{Dec}
(130) 
2007 
_{Jan}
(210) 
_{Feb}
(129) 
_{Mar}
(174) 
_{Apr}
(246) 
_{May}
(269) 
_{Jun}
(212) 
_{Jul}
(229) 
_{Aug}
(202) 
_{Sep}
(190) 
_{Oct}
(194) 
_{Nov}
(172) 
_{Dec}
(128) 
2008 
_{Jan}
(343) 
_{Feb}
(137) 
_{Mar}
(186) 
_{Apr}
(266) 
_{May}
(156) 
_{Jun}
(147) 
_{Jul}
(140) 
_{Aug}
(78) 
_{Sep}
(128) 
_{Oct}
(126) 
_{Nov}
(100) 
_{Dec}
(106) 
2009 
_{Jan}
(152) 
_{Feb}
(165) 
_{Mar}
(209) 
_{Apr}
(166) 
_{May}
(97) 
_{Jun}
(152) 
_{Jul}
(159) 
_{Aug}
(196) 
_{Sep}
(151) 
_{Oct}
(107) 
_{Nov}
(128) 
_{Dec}
(64) 
2010 
_{Jan}
(105) 
_{Feb}
(77) 
_{Mar}
(129) 
_{Apr}
(151) 
_{May}
(126) 
_{Jun}
(97) 
_{Jul}
(86) 
_{Aug}
(99) 
_{Sep}
(64) 
_{Oct}
(88) 
_{Nov}
(59) 
_{Dec}
(91) 
2011 
_{Jan}
(159) 
_{Feb}
(111) 
_{Mar}
(153) 
_{Apr}
(114) 
_{May}
(88) 
_{Jun}
(201) 
_{Jul}
(158) 
_{Aug}
(124) 
_{Sep}
(101) 
_{Oct}
(149) 
_{Nov}
(160) 
_{Dec}
(68) 
2012 
_{Jan}
(74) 
_{Feb}
(68) 
_{Mar}
(121) 
_{Apr}
(92) 
_{May}
(172) 
_{Jun}
(100) 
_{Jul}
(85) 
_{Aug}
(65) 
_{Sep}
(74) 
_{Oct}
(105) 
_{Nov}
(76) 
_{Dec}
(21) 
2013 
_{Jan}
(101) 
_{Feb}
(57) 
_{Mar}
(76) 
_{Apr}
(35) 
_{May}
(43) 
_{Jun}
(50) 
_{Jul}
(32) 
_{Aug}
(50) 
_{Sep}
(33) 
_{Oct}
(58) 
_{Nov}
(26) 
_{Dec}
(49) 
2014 
_{Jan}
(46) 
_{Feb}
(49) 
_{Mar}
(54) 
_{Apr}
(33) 
_{May}
(46) 
_{Jun}
(57) 
_{Jul}
(34) 
_{Aug}
(36) 
_{Sep}
(69) 
_{Oct}
(37) 
_{Nov}
(27) 
_{Dec}
(57) 
2015 
_{Jan}
(25) 
_{Feb}
(52) 
_{Mar}
(97) 
_{Apr}
(41) 
_{May}
(44) 
_{Jun}
(36) 
_{Jul}
(27) 
_{Aug}
(33) 
_{Sep}
(29) 
_{Oct}
(45) 
_{Nov}
(23) 
_{Dec}
(23) 
2016 
_{Jan}
(6) 
_{Feb}
(31) 
_{Mar}
(17) 
_{Apr}
(41) 
_{May}
(31) 
_{Jun}
(51) 
_{Jul}
(20) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 


1
(6) 
2
(2) 
3
(2) 
4
(22) 
5
(2) 
6
(3) 
7
(4) 
8
(12) 
9
(4) 
10
(5) 
11
(3) 
12
(6) 
13
(1) 
14
(4) 
15
(1) 
16
(6) 
17
(2) 
18
(1) 
19
(2) 
20
(1) 
21
(2) 
22
(2) 
23
(2) 
24
(3) 
25

26

27

28

29
(4) 
30
(3) 
31
(1) 



From: Rich E <reakinator@gm...>  20081221 19:07:07

I'm going to expand on what I think I need to do, which is modify the typemap to fit my specific format. So this is what I'm thinking: I start with this code for the typemap: /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) (PyArrayObject* array=NULL, int i=0) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array  !require_dimensions(array,1)  !require_contiguous(array)  !require_native(array)) SWIG_fail; $1 = 1; for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i); $2 = (DATA_TYPE*) array_data(array); } and try to alter it to allow for a conversion of type: (DIM_TYPE DIM1, DATA_TYPE* ARRAY1, DATA_TYPE* ARRAY2) where ARRAY1 is size DIM1 * 2 and ARRAY2 is size DIM1. Then I can %apply this to my function that I mentioned in the last post. So here are my first two questions: 1) where is DIM1 used to declare the array size? I don't see where it is used at all, and I need to somewhere multiply it by 2 to declare the size of ARRAY1 2) I am not understanding where $input comes from, so I do not understand how to distinguish between ARRAY1 and ARRAY2. In the attempt I have already tried, I think I just use the pointer to ARRAY1 twice. On Sun, Dec 21, 2008 at 7:12 PM, Rich E <reakinator@...> wrote: > Well I've made progress. In the numpy svn there is a good deal of > documentation about how to use the typemaps in numpy.i (btw, none of > which is related to the posted link I was previously/am confused > about). > > It is quite simple to add an %apply directive in the interface file like: > > %apply (int DIM1, float* INPLACE_ARRAY1) {(int sizeWaveform, float* pWaveform)}; > > which will then search and replace any function that has the two > variables in this format, effectively allowing the function to operate > on a numpy array. > > But what if I have multiple array pointers in the same function? For > example, here is a function in my library that converts spectra in > rectangular coordinates to polar form: > > /*! \brief compute magnitude spectrum of a DFT > * > * \param sizeMag size of output Magnitude (half of input real FFT) > * \param pFReal pointer to input FFT real array (real/imag floats) > * \param pFMAg pointer to float array of magnitude spectrum > */ > void sms_spectrumMag( int sizeMag, float *pInRect, float *pOutMag) > { > int i, it2; > float fReal, fImag; > > for (i=0; i<sizeMag; i++) > { > it2 = i << 1; > fReal = pInRect[it2]; > fImag = pInRect[it2+1]; > pOutMag[i] = sqrtf(fReal * fReal + fImag * fImag); > } > } > > > There are two arrays, one is half the size of the other. But, SWIG > doesn't know this, according to the type map it will think *pInRect is > of size sizeMag and will not know anything about *pOutMag. > > So what is the solution in this case? I assume that I will have to > make my own typemap based on the numpy.i file, but I cannot tell how > complicated or straightfoward this will be yet. I certainly don't > want to start adding unnecessary size integers to the c functions. > > regards, > Rich > > > On Mon, Dec 8, 2008 at 3:09 PM, Rich E <reakinator@...> wrote: >> On Mon, Dec 1, 2008 at 8:43 PM, Christopher Barker >> <Chris.Barker@...> wrote: >>> Rich E wrote: >>>> >>>> So I have a nice C library wrapped in python and I'd like to start >>>> doing some plots of things in python... the problem is the data is all >>>> stuck in C arrays. >>> >>>> But how would I go about returning a python list of the entire array, >>>> or even better, an NumPy array? >>> >>> there is a numpy.i file distributed with numpy ( or with the docs, anyway). >>> There was also a recent post on the numpy list with some extra hints and >>> examples for using it. >>> >>> This is another nice article about it: >>> >>> http://matt.eifelle.com/2008/11/04/exposinganarrayinterfacewithswigforaccstructure/ >> >> After looking at this example, I have to admit that I am a bit >> befuddled. I also couldn't get the code to work, but this is probably >> because I am not understanding the example. So, I'll ask a couple >> questions here and if there is a better place to do this, please let >> me know. >> >> In the example, Matt is converting data in a c struct.. all I want to >> do is, provided a pointer to a c array and the size of the array, >> convert it to a numpy array. Hopefully then I will not have to write >> a wrapper for every type of struct I have (and even worse, every >> function that handles pointers to arrays). >> >> I would think such a function could be quite general, enough to even >> be included with numpy. Matt's code is quite specific to the struct >> he is handling and it is difficult to see what is necessary for my >> very minimal needs. >> >>> >>>> My thoughts are that I will have to convert between C arrays and >>>> python types (list or NumPy) quite often, probably at a refresh rate >>>> suitable for animation. >>> >>> the above allow a numpy array and your Ccode to share the same pointer, so >>> it is very fast. >>> >>> Chris >>> >>> >>>  >>> Christopher Barker, Ph.D. >>> Oceanographer >>> >>> Emergency Response Division >>> NOAA/NOS/OR&R (206) 5266959 voice >>> 7600 Sand Point Way NE (206) 5266329 fax >>> Seattle, WA 98115 (206) 5266317 main reception >>> >>> Chris.Barker@... >>> >> > 
From: Rich E <reakinator@gm...>  20081221 18:12:48

Well I've made progress. In the numpy svn there is a good deal of documentation about how to use the typemaps in numpy.i (btw, none of which is related to the posted link I was previously/am confused about). It is quite simple to add an %apply directive in the interface file like: %apply (int DIM1, float* INPLACE_ARRAY1) {(int sizeWaveform, float* pWaveform)}; which will then search and replace any function that has the two variables in this format, effectively allowing the function to operate on a numpy array. But what if I have multiple array pointers in the same function? For example, here is a function in my library that converts spectra in rectangular coordinates to polar form: /*! \brief compute magnitude spectrum of a DFT * * \param sizeMag size of output Magnitude (half of input real FFT) * \param pFReal pointer to input FFT real array (real/imag floats) * \param pFMAg pointer to float array of magnitude spectrum */ void sms_spectrumMag( int sizeMag, float *pInRect, float *pOutMag) { int i, it2; float fReal, fImag; for (i=0; i<sizeMag; i++) { it2 = i << 1; fReal = pInRect[it2]; fImag = pInRect[it2+1]; pOutMag[i] = sqrtf(fReal * fReal + fImag * fImag); } } There are two arrays, one is half the size of the other. But, SWIG doesn't know this, according to the type map it will think *pInRect is of size sizeMag and will not know anything about *pOutMag. So what is the solution in this case? I assume that I will have to make my own typemap based on the numpy.i file, but I cannot tell how complicated or straightfoward this will be yet. I certainly don't want to start adding unnecessary size integers to the c functions. regards, Rich On Mon, Dec 8, 2008 at 3:09 PM, Rich E <reakinator@...> wrote: > On Mon, Dec 1, 2008 at 8:43 PM, Christopher Barker > <Chris.Barker@...> wrote: >> Rich E wrote: >>> >>> So I have a nice C library wrapped in python and I'd like to start >>> doing some plots of things in python... the problem is the data is all >>> stuck in C arrays. >> >>> But how would I go about returning a python list of the entire array, >>> or even better, an NumPy array? >> >> there is a numpy.i file distributed with numpy ( or with the docs, anyway). >> There was also a recent post on the numpy list with some extra hints and >> examples for using it. >> >> This is another nice article about it: >> >> http://matt.eifelle.com/2008/11/04/exposinganarrayinterfacewithswigforaccstructure/ > > After looking at this example, I have to admit that I am a bit > befuddled. I also couldn't get the code to work, but this is probably > because I am not understanding the example. So, I'll ask a couple > questions here and if there is a better place to do this, please let > me know. > > In the example, Matt is converting data in a c struct.. all I want to > do is, provided a pointer to a c array and the size of the array, > convert it to a numpy array. Hopefully then I will not have to write > a wrapper for every type of struct I have (and even worse, every > function that handles pointers to arrays). > > I would think such a function could be quite general, enough to even > be included with numpy. Matt's code is quite specific to the struct > he is handling and it is difficult to see what is necessary for my > very minimal needs. > >> >>> My thoughts are that I will have to convert between C arrays and >>> python types (list or NumPy) quite often, probably at a refresh rate >>> suitable for animation. >> >> the above allow a numpy array and your Ccode to share the same pointer, so >> it is very fast. >> >> Chris >> >> >>  >> Christopher Barker, Ph.D. >> Oceanographer >> >> Emergency Response Division >> NOAA/NOS/OR&R (206) 5266959 voice >> 7600 Sand Point Way NE (206) 5266329 fax >> Seattle, WA 98115 (206) 5266317 main reception >> >> Chris.Barker@... >> > 