Repository: wright-group/WrightTools

Issue:
[before h5] join takes set of points along each axis
currently join looks at each axis and tries to guess what the best evenly spaced points are

moving forward, join will simply take the set of all points in all data objects along each axis

interpolation will still be used for points that are not contained in any data set (within the convex hull, of course)

Discussion:

Patch:
diff --git a/WrightTools/data/_join.py b/WrightTools/data/_join.py
index 1f40775..56ae809 100644
--- a/WrightTools/data/_join.py
+++ b/WrightTools/data/_join.py
@@ -11,8 +11,10 @@ from ._data import Channel, Data
 
 # --- define --------------------------------------------------------------------------------------
 
+
 __all__ = ['join']
 
+
 # --- functions -----------------------------------------------------------------------------------
 
 
@@ -32,21 +34,11 @@ def join(datas, method='first', verbose=True, **kwargs):
     verbose : bool (optional)
         Toggle talkback. Default is True.
 
-    Keyword Arguments
-    -----------------
-    axis objects
-        The axes of the new data object. If not supplied, the points of the
-        new axis will be guessed from the given datas.
-
     Returns
     -------
-    data
-        A Data instance.
+    WrightTools.data.Data
+        A new Data instance.
     """
-    # TODO: a proper treatment of joining datas that have different dimensions
-    # with intellegent treatment of their constant dimensions. perhaps changing
-    # map_axis would be good for this. - Blaise 2015.10.31
-
     # copy datas so original objects are not changed
     datas = [d.copy() for d in datas]
     # get scanned dimensions
@@ -63,7 +55,6 @@ def join(datas, method='first', verbose=True, **kwargs):
                 axis_names.append(axis.name)
                 axis_units.append(axis.units)
                 axis_objects.append(axis)
-    # TODO: transpose to same dimension orders
     # convert into same units
     for data in datas:
         for axis_name, axis_unit in zip(axis_names, axis_units):
@@ -73,26 +64,11 @@ def join(datas, method='first', verbose=True, **kwargs):
     # get axis points
     axis_points = []  # list of 1D arrays
     for axis_name in axis_names:
-        if axis_name in kwargs.keys():
-            axis_points.append(kwargs[axis_name].points)
-            continue
-        all_points = np.array([])
-        step_sizes = []
+        points = np.full((0), np.nan)
         for data in datas:
-            for axis in data.axes:
-                if axis.name == axis_name:
-                    all_points = np.concatenate([all_points, axis.points])
-                    this_axis_min = np.nanmin(axis.points)
-                    this_axis_max = np.nanmax(axis.points)
-                    this_axis_number = float(axis.points.size) - 1
-                    step_size = (this_axis_max - this_axis_min) / this_axis_number
-                    step_sizes.append(step_size)
-        axis_min = np.nanmin(all_points)
-        axis_max = np.nanmax(all_points)
-        axis_step_size = min(step_sizes)
-        axis_n_points = np.ceil((axis_max - axis_min) / axis_step_size)
-        points = np.linspace(axis_min, axis_max, axis_n_points + 1)
-        axis_points.append(points)
+            index = data.axis_names.index(axis_name)
+            points = np.hstack((points, data.axes[index].points))
+        axis_points.append(np.unique(points))
     # map datas to new points
     for axis_index, axis_name in enumerate(axis_names):
         for data in datas:


Test patch:
diff --git a/tests/data/join.py b/tests/data/join.py
index 3d77f1f..72b9bc0 100644
--- a/tests/data/join.py
+++ b/tests/data/join.py
@@ -1,8 +1,18 @@
+"""Test join."""
+
+
+# --- import --------------------------------------------------------------------------------------
+
+
 import numpy as np
 
 import WrightTools as wt
 from WrightTools import datasets
 
+
+# --- test ----------------------------------------------------------------------------------------
+
+
 def test_wm_w2_w1():
     p = datasets.PyCMDS.wm_w2_w1_000
     a = wt.data.from_PyCMDS(p)