Category: Python

Python Scripts, Tutorials, and News.

Python Packing Streams of Arbitrary Length

When starting out with IO and learning to efficiently read and write binary structures to and from Python most people will confront the problem of packing a string or list into a structure. Variations of this question plague Stack Overflow, here are two quick examples:https://stackoverflow.com/questions/3753589/packing-and-unpacking-variable-length-array-string-using-the-struct-module-in-py, https://stackoverflow.com/questions/34117620/how-to-unpack-variable-length-data-in-python-struct I have a rather simple solution I decided to […]

Human Readable Spectrum Files
Human Readable Spectrum Files

XML based spectrum files and a Python class for reading, writing, and modifying them. I was hoping to put together a Javascript tool for visualising the Red-shift of different celestial phenomena over different distances.Sadly it didn’t take long to learn the dominant file format for spectra (.SPC) is binary encoded and pretty complex; as a […]

Back to top