def open_app( self ):
     folder = request_old_directory().path
     manager = fitsmanager.FitsManager( folder )
     dcw = groundgui.DataControlWindow(manager)
     dcw.show()
     groundgui.DataViewWindow(manager).show()
     pcw = groundgui.PlotControlWindow(manager)
     pcw.show()
     dcw.set_plotwindow(pcw)
    """Converts a .spaceball or .fit into a _ext.fits."""
    base = filename.rpartition('.')[0]
    if not os.path.exists(filename):
        raise ValueError("{0} does not exist.".format(filename))
        
    if filename.endswith('.spaceball'):
        if clobber or not os.path.exists(base+'.fit'):
            success = convert_spaceball(filename)
            if success:
                convert_file(base+'.fit')
    elif filename.endswith('.fit'):
        if clobber or not os.path.exists(base+'_ext.fits'):
            reshape_fits(filename)

def convert_folder(folder, clobber=False):
    """Calls convert_file on every .spaceball or .fit in the folder."""
    spaceballs = glob.glob(os.path.join(folder,'*.spaceball'))
    fits = glob.glob(os.path.join(folder,'*.fit'))
    for f in spaceballs+fits:
        convert_file(f, clobber=clobber)

def purge_zeros(data):
    return data[data.field(0) != 0]


if __name__ == '__main__':
    from GUI import application
    from GUI.FileDialogs import request_old_directory
    application()
    convert_folder(request_old_directory().path)