Moved utility functions from q1d_otto_merge.py to q1d.py