[f2py] scipy 0.4.8 and f2py

fabien.wahl at snecma.fr fabien.wahl at snecma.fr
Tue Apr 25 09:19:33 EEST 2006



Bonjour,



Thanks for the clarification. But isn't it becoming confusing and

complicated?



The way Numeric (23.8 in my case) and numpy handle string arrays are

different, and lead to respectively success or failure of a called fortran

block.

Numeric used to convert the string array down to character array, whereas

numpy keeps and array of strings (which is more sensible, but fails in

fortran)

Any clue?



Regards,

Fab.





the fortran subroutine



      SUBROUTINE FOO2(A)

      CHARACTER*5, dimension(2) :: A

Cf2py intent(in) a

      PRINT*, "A(1)=",A(1)

      PRINT*, "A(2)=",A(2)

      END



The python testing



>>> from Numeric import array

>>> a=array(('abcde','vwxyz'))

>>> a

array([[a, b, c, d, e],

       [v, w, x, y, z]],'c')

>>> mystring_new.foo2(a)

 A(1)=abcde

 A(2)=vwxyz

>>> from numpy import array

>>> a=array(('abcde','vwxyz'))

>>> a

array([abcde, vwxyz],

      dtype='|S5')

>>> mystring_new.foo2(a)

1-th dimension must be 5 but got 0 (not defined).

Traceback (most recent call last):

  File "<stdin>", line 1, in ?

mystring_new.error: failed in converting 1st argument `a' of

mystring_new.foo2 t

o C/Fortran array



--------------------

Fabien WAHL

Ingénieur Etudes Nouvelles

Unité de conception de Turbomachines



SNECMA, Division Moteur Spatiaux

Direction Grosse Propulsion à Liquides

Forêt de Vernon BP 802

27208 VERNON

FRANCE



Tel   +33 (0)2 32 21 72 77

Fax   +33 (0)2 32 21 76 30

mailto:fabien.wahl at snecma.fr





|---------+------------------------------->

|         |                               |

|         |                               |

|         |                               |

|         |           Robert Kern         |

|         |           <robert.kern at gmail.c|

|         |           om>                 |

|         |           Envoyé par :        |

|         |           f2py-users-bounces at c|

|         |           ens.ioc.ee          |

|         |                               |

|         |                               |

|         |           24/04/2006 18:14    |

|         |                               |

|---------+------------------------------->

  >---------------------------------------------------------------------------------------------------------------------------|

  |        Pour :      f2py-users at cens.ioc.ee                                                                                 |

  |           cc :                                                                                                            |

  |          Objet :   Re: [f2py] scipy 0.4.8 and f2py                                                                        |

  >---------------------------------------------------------------------------------------------------------------------------|











fabien.wahl at snecma.fr wrote:

> Bonjour,

>

> The latest scipy comes with f2py. Does this f2py require numpy (included

in

> scipy) or Numeric? And what version of the numerical package?

> A bit confusing to upgrade, some former code won't migrate anymore (array

> of strings cannot be sent to fortran anymore)



numpy comes with f2py. scipy does not. scipy 0.4.x requires numpy, not

Numeric.

The f2py that comes with numpy does not in general work with Numeric nor

does

the old standalone f2py work with numpy.



--

Robert Kern

robert.kern at gmail.com



"I have come to believe that the whole world is an enigma, a harmless

enigma

 that is made terrible by our own mad attempt to interpret it as though it

had

 an underlying truth."

  -- Umberto Eco





_______________________________________________

f2py-users mailing list

f2py-users at cens.ioc.ee

http://cens.ioc.ee/mailman/listinfo/f2py-users















#

  This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, please advise the sender immediately and delete this e-mail and all attached documents from your computer system. Any unauthorised disclosure, distribution or copying hereof is prohibited. 



  Ce courriel et les documents qui y sont attaches peuvent contenir des informations confidentielles. Au cas ou vous ne seriez pas le destinataire de ce courriel, vous etes prie d'en informer l'expediteur immediatement et de le detruire  ainsi que tous les documents attaches de votre systeme informatique. Toute divulgation, distribution ou copie du present courriel et des documents attaches sans autorisation prealable de son emetteur est interdite. 

#




More information about the f2py-users mailing list