Numpy and cPickle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Manns

    #1

    Numpy and cPickle

    Hi

    If I cPickle a numpy array under Linux and un-cPickle it under Solaris
    10, my arrays seem to be transposed. Is there any way to get the same
    behavior on both platforms without testing which platform the python
    script runs on and then transposing the array?

    I am using python 2.4.2 and numpy 0.9.6 on both machines.

    Thanks in advance

    Martin
  • Robert Kern

    #2
    Re: Numpy and cPickle

    Martin Manns wrote:[color=blue]
    > Hi
    >
    > If I cPickle a numpy array under Linux and un-cPickle it under Solaris
    > 10, my arrays seem to be transposed. Is there any way to get the same
    > behavior on both platforms without testing which platform the python
    > script runs on and then transposing the array?
    >
    > I am using python 2.4.2 and numpy 0.9.6 on both machines.[/color]

    Transposed? That's odd. There was a byteorder issue with pickles going across
    differently-endianed platforms that was fixed in the past few days. Could you
    come up with a small bit of code that shows the problem and post it and the
    incorrect output to the bug tracker?



    Thank you!

    --
    Robert Kern
    robert.kern@gma il.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

    Comment

    • Martin Manns

      #3
      Re: Numpy and cPickle

      Robert Kern wrote:[color=blue]
      > Martin Manns wrote:[/color]
      [color=blue][color=green]
      >> If I cPickle a numpy array under Linux and un-cPickle it under Solaris
      >> 10, my arrays seem to be transposed.[/color]
      > Transposed? That's odd. There was a byteorder issue with pickles going across
      > differently-endianed platforms that was fixed in the past few days. Could you
      > come up with a small bit of code that shows the problem and post it and the
      > incorrect output to the bug tracker?[/color]

      Sorry, I my ad-hoc small example does not reproduce the error even
      though the files generated on both platforms differ. I will try to set
      up the code tomorrow.

      Thank you though for the fast response

      Martin

      Comment

      • Mr. M

        #4
        Re: Numpy and cPickle

        Martin Manns wrote:[color=blue]
        > Robert Kern wrote:[color=green]
        >> Martin Manns wrote:[/color]
        >[color=green][color=darkred]
        >>> If I cPickle a numpy array under Linux and un-cPickle it under Solaris
        >>> 10, my arrays seem to be transposed.[/color]
        >> Transposed? That's odd. There was a byteorder issue with pickles going across
        >> differently-endianed platforms that was fixed in the past few days. Could you
        >> come up with a small bit of code that shows the problem and post it and the
        >> incorrect output to the bug tracker?[/color]
        >
        > Sorry, I my ad-hoc small example does not reproduce the error even
        > though the files generated on both platforms differ. I will try to set
        > up the code tomorrow.[/color]

        Somehow, the bug does not show up any more. I believe it was due to the
        numpy version that is fetched by cPickle. Is there any way to control
        (or even determine), which library version cPickle grabs for unpickling
        a numpy array (numpy, scipy, etc)?

        Comment

        • Robert Kern

          #5
          Re: Numpy and cPickle

          Mr. M wrote:
          [color=blue]
          > Somehow, the bug does not show up any more. I believe it was due to the
          > numpy version that is fetched by cPickle. Is there any way to control
          > (or even determine), which library version cPickle grabs for unpickling
          > a numpy array (numpy, scipy, etc)?[/color]

          You can import the appropriate module first. Then it will be in sys.modules and
          be picked up during unpickling. You may have to do some sys.path manipulation if
          you have more than one version lieing about on your filesystem.

          --
          Robert Kern
          robert.kern@gma il.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

          Comment

          Working...