from __future__ import print_function

"""
Explanation: Quick Start
End of explanation
"""


from pebaystats import dstats

"""
Explanation: Import the aggregation object from the module.
End of explanation
"""


stats1 = dstats(2,1)
stats2 = dstats(4,4)
stats3 = dstats(2,1)

"""
Explanation: Create a few objects with various depths (number of moments) and widths (number of columns to compute statistics for).  Here the stats1 and stats3 objects each accumulate two moments for a single column of data, and the stats2 object collects 4 statistical moments for 4 columns of data.
End of explanation
"""


stats1.add(2)
stats1.add(2)
stats1.add(2)
print('stats1: %s' % stats1)
print('statistics: %s' % stats1.statistics())

"""
Explanation: Add individual data values to the single column accumulation of the stats1 object.  Print the object to view its state, which includes the moment values so far accumulated.  Also, print the list of lists returned from the statistics() method call.  Here you can see that the mean is 2.0 and the variance is 0.0.
End of explanation
"""


stats2.add([1.2,2,3,9])
stats2.add([4.5,6,7,9])
stats2.add([8.9,0,1,9])
stats2.add([2.3,4,5,9])
print('stats2: %s' % stats2)
print('statistics: %s' % stats2.statistics(True))

"""
Explanation: Add entire rows (multiple columns) of values to the stats2 object.  View the accumulated results.  Note that when the second moment (n * Var) is 0, equivalent to a deviation of 0, the higher moments are left in there initial 0 state.  The higher statistics are set to a NaN value in this case.
End of explanation
"""


# stats2.remove(1.2,2,3,9)

"""
Explanation: Remove data (UNIMPLEMENTED) from the stats2 object.
End of explanation
"""


stats3.add(4)
stats3.add(4)
stats3.add(4)
print('stats3: %s' % stats3)
print('statistics: %s' % stats3.statistics())

"""
Explanation: Load the stats3 object with with data and view the results.
End of explanation
"""


stats1.aggregate(stats3)
print('stast1: %s' % stats1)
print('statistics: %s' % stats1.statistics(True))

"""
Explanation: Now aggregate that object onto the first.  This only works when the shapes are the same.
End of explanation
"""


