deparkes / OOMMFTools

OOMMFTools is a set of utilities designed to assist OOMMF postprocessing
GNU General Public License v2.0
18 stars 8 forks source link

Unpacking error: error('unpack requires a buffer of 4 bytes',) #23

Open JianYugen opened 3 years ago

JianYugen commented 3 years ago

Hi. I've met an issue recently when using OOMMFDecode to convert .ovf files into MATLAB data files. The program runs correctly for vector files in most cases. But when it comes to some scalar files, there arises error message as below:

Data indicator: # Begin: Data Binary 4
Little-endian 4-byte detected.
unpack requires a buffer of 4 bytes
Traceback (most recent call last):
  File "D:\OOMMFTools\oommftools\user_interfaces\gui\oommfdecode.py", line 216, in OnDropFiles
    maximum=len(oommf)))
  File "D:\OOMMFTools\oommftools\user_interfaces\gui\oommfdecode.py", line 243, in groupUnpack
    return (decodedArrays, headers, extraData)
UnboundLocalError: local variable 'decodedArrays' referenced before assignment

error

In OOMMF, the relevant quantities of scalar files are saved in the X coordinate, so they are still vectors in fact. Actually I can check scalar files through other ways, and I'm just wondering what goes wrong. Thanks.

deparkes commented 3 years ago

Hi, Would you be able to share an example of a file that causes this error?

JianYugen commented 3 years ago

There's a file output by mumax3 (mumax3 is a GPU-accelerated micromagnetic simulation program). It saved the temperature distribution of the system, where I defined a thermal gradient (300-500K) along the X direction. Fig.1 shows what it views in OOMMF. Fig.2 is the bitmap file converted by OOMMFConvert.

example.zip

deparkes commented 3 years ago

Thanks, I can recreate the error now. I'll see if I can find and fix the problem, but I'm glad you're able to check the scalar files in other ways in case I can't fix it!

JianYugen commented 3 years ago

Good luck! MATLAB data files would be always easier for me to analyse.