XENON1T / pax

The XENON1T raw data processor [deprecated]
BSD 3-Clause "New" or "Revised" License
16 stars 15 forks source link

Replace fromstring to frombuffer #683

Closed tunnell closed 6 years ago

tunnell commented 6 years ago

frombuffer is now preferred within numpy when dealing with binary data. This solves "DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead"

tunnell commented 6 years ago

@feigaodm @JelleAalbers thoughts? needs approval, ready to merge

JelleAalbers commented 6 years ago

I'm surprised numpy deprecated this. frombuffer has the 'feature' that if you pass it an immutable object (such as a bytes) the resulting array will also be readonly. That can cause some interesting failures; the solution is probably to copy things into a bytearray first. But since the test pass, we could just wait if something will go wrong now...

feigaodm commented 6 years ago

haha, @JelleAalbers sorry if I merged too fast because I see @tunnell was doing a lot of commits and it might be urgent. But as you said, we will see if it brings new problems and fix them

tunnell commented 6 years ago

Regardless, we need a solution due to the deprecation warning. If it produces a bug, we can look at a better way to fix it. It just deprecated fromstring for byte strings.

tunnell commented 6 years ago

Also, it's mainly the XED thing that we should probably deprecate anyways at some point, even though it's used for all tests