Commit c671a6cf authored by Christopher Shallue's avatar Christopher Shallue
Browse files

Replace itertools.izip() with zip() for Python3 compatibility.

This is not a performance issue for the instances replaced because
each instance is expected to iterate over zipped lists of < ~20
references to numpy arrays.
parent 2e5cbaac
......@@ -19,7 +19,6 @@ from __future__ import division
from __future__ import print_function
import collections
import itertools
import numpy as np
from six.moves import range # pylint:disable=redefined-builtin
......@@ -72,7 +71,7 @@ def split(all_time, all_flux, gap_width=0.75):
out_time = []
out_flux = []
for time, flux in itertools.izip(all_time, all_flux):
for time, flux in zip(all_time, all_flux):
start = 0
for end in range(1, len(time) + 1):
# Choose the largest endpoint such that time[start:end] has no gaps.
......@@ -117,7 +116,7 @@ def remove_events(all_time, all_flux, events, width_factor=1.0):
output_time = []
output_flux = []
for time, flux in itertools.izip(all_time, all_flux):
for time, flux in zip(all_time, all_flux):
mask = np.ones_like(time, dtype=np.bool)
for event in events:
transit_dist = np.abs(phase_fold_time(time, event.period, event.t0))
......@@ -149,7 +148,7 @@ def interpolate_masked_spline(all_time, all_masked_time, all_masked_spline):
points linearly interpolated.
"""
interp_spline = []
for time, masked_time, masked_spline in itertools.izip(
for time, masked_time, masked_spline in zip(
all_time, all_masked_time, all_masked_spline):
if len(masked_time) > 0: # pylint:disable=g-explicit-length-test
interp_spline.append(np.interp(time, masked_time, masked_spline))
......
......@@ -4,7 +4,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import warnings
import numpy as np
......@@ -149,7 +148,7 @@ def choose_kepler_spline(all_time,
spline = []
spline_mask = []
bad_bkspace = False # Indicates that the current bkspace should be skipped.
for time, flux in itertools.izip(all_time, all_flux):
for time, flux in zip(all_time, all_flux):
# Don't fit a spline on less than 4 points.
if len(time) < 4:
spline.append(flux)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment