@@ -0,0 +1,1641 @@
+from __future__ import division%0A%0Afrom astropy.table import Table%0Aimport numpy as np%0Afrom mica.archive import aca_l0, asp_l1%0Afrom Ska.Numpy import interpolate%0A%0A%0Adef test_get_l0_images():%0A    %22%22%22%0A    Do a validation test of get_l0_images:%0A    - Get 20 mins of image data for slot 6 of obsid 8008 (very nice clean stars)%0A    - Do first moment centroids in row and col%0A    - Compare to aspect pipeline FM centroids for same slot data%0A%0A    This is a deep test that all the signs are right.  If not then everything%0A    breaks badly because the star image doesn't move in sync with row0, col0.%0A    %22%22%22%0A    start = '2007:002:06:00:00'%0A    stop = '2007:002:06:20:00'%0A%0A    imgs = aca_l0.get_l0_images(start, stop, slot=6)%0A%0A    files = asp_l1.get_files(8008, content=%5B'ACACENT'%5D)%0A    acen = Table.read(files%5B0%5D)%0A    # Pick FM centroids for slot 6%0A    ok = (acen%5B'alg'%5D == 1) & (acen%5B'slot'%5D == 6)%0A    acen = acen%5Bok%5D%0A%0A    # Row and col centroids%0A    rcs = %5B%5D%0A    ccs = %5B%5D%0A    times = %5Bimg.TIME for img in imgs%5D%0A%0A    # Easy way to do FM centroids with mgrid%0A    rw, cw = np.mgrid%5B0:6, 0:6%5D%0A    # rw = %5B%5B0, 0, 0, 0, 0, 0%5D,%0A    #       %5B1, 1, 1, 1, 1, 1%5D,%0A    #       %5B2, 2, 2, 2, 2, 2%5D,%0A    #       %5B3, 3, 3, 3, 3, 3%5D,%0A    #       %5B4, 4, 4, 4, 4, 4%5D,%0A    #       %5B5, 5, 5, 5, 5, 5%5D%5D%0A%0A    for img in imgs:%0A        norm = np.sum(img)%0A        rcs.append(np.sum(img * rw) / norm + img.row0)%0A        ccs.append(np.sum(img * cw) / norm + img.col0)%0A%0A    rcen = interpolate(acen%5B'cent_i'%5D, acen%5B'time'%5D, times)%0A    ccen = interpolate(acen%5B'cent_j'%5D, acen%5B'time'%5D, times)%0A%0A    assert np.all(np.abs(rcen - rcs) %3C 0.05)%0A    assert np.all(np.abs(ccen - ccs) %3C 0.05)%0A

Add minimal tests for aca_l0