old_contents: # coding: utf-8
  
  """ Utilities for the streams project. """
  
  from __future__ import division, print_function
  
  __author__ = "adrn <adrn@astro.columbia.edu>"
  
  # Standard library
  import os, sys
  import re
  import logging
  from datetime import datetime
  import resource
  import shutil
  
  # Third-party
  from astropy.utils.misc import isiterable
  import astropy.units as u
  import numpy as np
  
  __all__ = ["_validate_coord", "project_root", "u_galactic"]
  
  # Create logger
  logger = logging.getLogger(__name__)
  
  # This code will find the root directory of the project
  _pattr = re.compile("(.*)\/streams")
  try:
      matched_path = _pattr.search(os.getcwd()).groups()[0]
  except AttributeError: # match not found, try __file__ instead
      matched_path = _pattr.search(__file__).groups()[0]
  
  if os.path.basename(matched_path) == "streams":
      project_root = matched_path
  else:
      project_root = os.path.join(matched_path, "streams")
  
  #
  def _validate_coord(x):
      if isiterable(x):
          return np.array(x, copy=True)
      else:
          return np.array([x])
  
  u_galactic = [u.kpc, u.Myr, u.M_sun, u.radian]
  
  def get_memory_usage():
      """
      Returning resident size in megabytes
      """
      pid = os.getpid()
      try:
          pagesize = resource.getpagesize()
      except NameError:
          return -1024
      status_file = "/proc/%s/statm" % (pid)
      if not os.path.isfile(status_file):
          return -1024
      line = open(status_file).read()
      size, resident, share, text, library, data, dt = [int(i) for i in
  line.split()]
      return resident * pagesize / (1024 * 1024) # return in megs
new_contents: # coding: utf-8
  
  """ Utilities for the streams project. """
  
  from __future__ import division, print_function
  
  __author__ = "adrn <adrn@astro.columbia.edu>"
  
  # Standard library
  import os, sys
  import re
  import logging
  from datetime import datetime
  import resource
  import shutil
  
  # Third-party
  from astropy.utils.misc import isiterable
  import astropy.units as u
  import numpy as np
  
  __all__ = ["_validate_coord", "project_root", "u_galactic"]
  
  # Create logger
  logger = logging.getLogger(__name__)
  
  # This code will find the root directory of the project
  _pattr = re.compile("(.*)\/streams")
  try:
      matched_path = _pattr.search(os.getcwd()).groups()[0]
  except AttributeError: # match not found, try __file__ instead
      matched_path = _pattr.search(__file__).groups()[0]
  
  if os.path.basename(matched_path) == "streams":
      project_root = matched_path
  else:
      project_root = os.path.join(matched_path, "streams")
  
  #
  def _validate_coord(x):
      if isiterable(x):
          return np.array(x, copy=True)
      else:
          return np.array([x])
  
  u_galactic = [u.kpc, u.Myr, u.M_sun, u.radian]
  
  def get_memory_usage():
      """
      Returning resident size in megabytes
      """
      pid = os.getpid()
      try:
          pagesize = resource.getpagesize()
      except NameError:
          return -1024
      status_file = "/proc/%s/statm" % (pid)
      if not os.path.isfile(status_file):
          return -1024
      line = open(status_file).read()
      size, resident, share, text, library, data, dt = [int(i) for i in
  line.split()]
      return resident * pagesize / (1024 * 1024) # return in megs
  
  def _parse_quantity(q):
      try:
          val,unit = q.split()
      except AttributeError:
          val = q
          unit = u.dimensionless_unscaled
  
      return u.Quantity(float(val), unit)
subject: move parse quantity