# Path: pygeo/coord.py
# def reduceToLocal (origpoints, angle=0., about=[0.,0.,0.]):
#   about = np.array(about)
#   return rotationPlan(origpoints, angle, about) - about


import numpy as np
import sys
from optparse import OptionParser
from pygeo.segyread import SEGYFile
from pygeo.coord import reduceToLocal
  trhl0 = sf.trhead[sf.ensembles[shotnums[i]]]
  sx = trhl0['sx'] * scalco
  sy = trhl0['sy'] * scalco
  sz = trhl0['selev'] * scalel * zantithesis

  (nsx, nsy, nsz) = reduceToLocal(np.array([sx,sy,sz],ndmin=2), angle, basis)[0]

  # Append information about this shot to the running tally of all shot
  # locations; this is used to construct f.in
  shotlocs[0].append(nsx)
  shotlocs[1].append(nsy)
  shotlocs[2].append(nsz)

  outlines.append(format_string % (nsx, nsy, nsz, 0., 0., -1))

  tr0 = sf.ensembles[shotnums[i]]

  if (i == ngathers - 1):
    tr1 = sf.ntr - 1
  else:
    tr1 = sf.ensembles[shotnums[i+1]]

  shotactive.append(0)

  for j in xrange(tr0, tr1):
    trhl = sf.trhead[j]
    rx = trhl['gx'] * scalco
    ry = trhl['gy'] * scalco
    rz = trhl['gelev'] * scalel * zantithesis


# Path: pygeo/coord.py
# def reduceToLocal (origpoints, angle=0., about=[0.,0.,0.]):
#   about = np.array(about)
#   return rotationPlan(origpoints, angle, about) - about


# Path: util/segy2fast.py
import numpy as np
import sys
from optparse import OptionParser
from pygeo.segyread import SEGYFile
from pygeo.coord import reduceToLocal

  trhl0 = sf.trhead[sf.ensembles[shotnums[i]]]
  sx = trhl0['sx'] * scalco
  sy = trhl0['sy'] * scalco
  sz = trhl0['selev'] * scalel * zantithesis

  (nsx, nsy, nsz) = reduceToLocal(np.array([sx,sy,sz],ndmin=2), angle, basis)[0]

  # Append information about this shot to the running tally of all shot
  # locations; this is used to construct f.in
  shotlocs[0].append(nsx)
  shotlocs[1].append(nsy)
  shotlocs[2].append(nsz)

  outlines.append(format_string % (nsx, nsy, nsz, 0., 0., -1))

  tr0 = sf.ensembles[shotnums[i]]

  if (i == ngathers - 1):
    tr1 = sf.ntr - 1
  else:
    tr1 = sf.ensembles[shotnums[i+1]]

  shotactive.append(0)

  for j in xrange(tr0, tr1):
    trhl = sf.trhead[j]
    rx = trhl['gx'] * scalco
    ry = trhl['gy'] * scalco
    rz = trhl['gelev'] * scalel * zantithesis


    (nrx, nry, nrz) = reduceToLocal(np.array([rx,ry,rz],ndmin=2), angle, basis)[0]