def test_allowed_bins(self):
        x = np.asarray(np.asarray([0,1,2,3]))
        y = np.asarray(np.asarray([1,1,1,1]))
        dy = np.asarray(np.asarray([1,1,1,1]))
        g = invariant.Guinier()
        data = Data1D(x=x, y=y, dy=dy)
        self.assertEqual(g.get_allowed_bins(data), [False, True, True, True])

        data = Data1D(x=y, y=x, dy=dy)
        self.assertEqual(g.get_allowed_bins(data), [False, True, True, True])

        data = Data1D(x=dy, y=y, dy=x)
        self.assertEqual(g.get_allowed_bins(data), [False, True, True, True])
 def test_linearization(self):
     """
         Check that the linearization process filters out points
         that can't be transformed
     """
     x = np.asarray(np.asarray([0,1,2,3]))
     y = np.asarray(np.asarray([1,1,1,1]))
     g = invariant.Guinier()
     data_in = Data1D(x=x, y=y)
     data_out = g.linearize_data(data_in)
     x_out, y_out, dy_out = data_out.x, data_out.y, data_out.dy
     self.assertEqual(len(x_out), 3)
     self.assertEqual(len(y_out), 3)
     self.assertEqual(len(dy_out), 3)
 def test_guinier_incompatible_length(self):
     g = invariant.Guinier()
     data_in = Data1D(x=[1], y=[1,2], dy=None)
     self.assertRaises(AssertionError, g.linearize_data, data_in)
     data_in = Data1D(x=[1,1], y=[1,2], dy=[1])
     self.assertRaises(AssertionError, g.linearize_data, data_in)