Changeset 379

Show
Ignore:
Timestamp:
12/30/07 09:06:48 (10 months ago)
Author:
astraw
Message:

cleanup calls to motmot namespace package; remove whitespace

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/FastImage/examples/cross_corr.py

    r87 r379  
    11from __future__ import division 
    2 import FastImage 
     2import motmot.FastImage.FastImage as FastImage 
    33import numpy 
    44 
     
    9191        print numpy.asarray(result32f) 
    9292        print 
    93          
     93 
    9494    if 1: 
    9595        # use preallocated memory (32 bit float) 
     
    101101            print numpy.asarray(pre_alloc_result_32f) 
    102102            print 
    103          
     103 
    104104        max_val,x,y=pre_alloc_result_32f.max_index(result_size) 
    105105        print 'max_val,x,y',max_val,x,y 
  • trunk/FastImage/examples/simple.py

    r87 r379  
    11from __future__ import division 
    2 import FastImage 
     2import motmot.FastImage.FastImage as FastImage 
    33import numpy 
    44 
  • trunk/FastImage/examples/test.py

    r87 r379  
    1 import FastImage as fi 
     1import motmot.FastImage.FastImage as fi 
    22 
    33width = 10 
  • trunk/FastImage/motmot/FastImage/tests.py

    r361 r379  
    2323        self.assert_(s1 is not s2) 
    2424        self.assert_(s1 != s3) 
    25      
     25 
    2626class TestFastImageBase(unittest.TestCase): 
    2727    def setUp(self): 
     
    3030        self.ar_dtypes = [nx.uint8, 
    3131                          nx.float32] 
    32          
     32 
    3333    def test_roi(self): 
    3434        sz = fi.Size(20,10) 
     
    7373            arA = nx.zeros((size.h, size.w),ar_dtype) 
    7474            self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    75              
     75 
    7676    def test_getitem(self): 
    7777        size = fi.Size(20,10) 
     
    9696    def test_32f_copy(self): 
    9797        sz = fi.Size(20,10) 
    98          
     98 
    9999        imA=fi.FastImage8u(sz) 
    100100        imA.set_val(87,sz) 
    101          
     101 
    102102        imB=fi.FastImage32f(sz) 
    103103        imA.get_32f_copy_put(imB,sz) 
     
    111111        B = 38 
    112112        sz = fi.Size(33,323) 
    113          
     113 
    114114        imA=fi.FastImage8u(sz) 
    115115        imA.set_val(A,sz) 
     
    120120        imC=fi.FastImage8u(sz) 
    121121        imA.get_absdiff_put(imB,imC,sz) 
    122          
     122 
    123123        arA = A*nx.ones((sz.h, sz.w),nx.int16) 
    124124        arB = B*nx.ones((sz.h, sz.w),nx.int16) 
    125125        arC = abs(arA - arB) 
    126126        self.assert_( nx.allclose(arC, nx.asarray(imC))) 
    127          
     127 
    128128    def test_absdiff2(self): 
    129129 
     
    131131        B = 38 
    132132        sz = fi.Size(656,491) 
    133          
     133 
    134134        imA=fi.FastImage8u(sz) 
    135135        imA.set_val(A,sz) 
     
    140140        imC=fi.FastImage8u(sz) 
    141141        imA.get_absdiff_put(imB,imC,sz) 
    142          
     142 
    143143        arA = A*nx.ones((sz.h, sz.w),nx.int16) 
    144144        arB = B*nx.ones((sz.h, sz.w),nx.int16) 
    145145        arC = abs(arA - arB) 
    146146        self.assert_( nx.allclose(arC, nx.asarray(imC))) 
    147          
     147 
    148148    def test_sub(self): 
    149149 
     
    151151        B = 38 
    152152        sz = fi.Size(656,491) 
    153          
     153 
    154154        imA=fi.FastImage8u(sz) 
    155155        imA.set_val(A,sz) 
     
    158158        imB.set_val(B,sz) 
    159159 
    160         imC=fi.FastImage8u(sz)  
     160        imC=fi.FastImage8u(sz) 
    161161        imA.get_sub_put(imB,imC,sz) # imC = imA - imB 
    162          
    163         imD=fi.FastImage8u(sz)  
     162 
     163        imD=fi.FastImage8u(sz) 
    164164        imB.get_sub_put(imA,imD,sz) # imD = imB - im A 
    165165 
     
    174174    def test_iconvert(self): 
    175175        sz = fi.Size(2,2) 
    176          
     176 
    177177        imB=fi.FastImage32f(sz) 
    178178        imB.set_val(3.2,sz) 
     
    186186        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    187187        self.assert_( nx.allclose(arB, nx.asarray(imB))) 
    188          
     188 
    189189class TestFastImage32f(unittest.TestCase): 
    190190    def test_roi(self): 
    191191        sz = fi.Size(20,10) 
    192          
     192 
    193193        imA=fi.FastImage32f(sz) 
    194194        imA.set_val(87,sz) 
     
    199199        imB=imA.roi(left,bottom,onepix) 
    200200        imB.set_val(12,onepix) 
    201          
     201 
    202202        arA = 87*nx.ones((sz.h, sz.w),nx.float32) 
    203203        arA[bottom,left]=12 
    204204        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    205          
     205 
    206206    def test_add_weighted_8u(self): 
    207207 
     
    210210        alpha = 0.3 
    211211        sz = fi.Size(20,10) 
    212          
     212 
    213213        imA=fi.FastImage32f(sz) 
    214214        imA.set_val(A,sz) 
     
    223223        arA = arA*(1.0-alpha) + arB*alpha 
    224224        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    225          
     225 
    226226    def test_add_weighted_32f(self): 
    227227 
     
    230230        alpha = 0.3 
    231231        sz = fi.Size(33,33) 
    232          
     232 
    233233        imA=fi.FastImage32f(sz) 
    234234        imA.set_val(A,sz) 
     
    247247        A = 32.2 
    248248        sz = fi.Size(5,5) 
    249          
     249 
    250250        imA=fi.FastImage32f(sz) 
    251251        imA.set_val(A,sz) 
     
    258258        arC=(arA**8).astype(nx.float32) 
    259259        self.assert_( nx.allclose(arC, nx.asarray(imC))) 
    260          
     260 
    261261    def test_sqrt(self): 
    262262        A = 32.2 
    263263        sz = fi.Size(5,245) 
    264          
     264 
    265265        imA=fi.FastImage32f(sz) 
    266266        imA.set_val(A,sz) 
     
    276276        B = 82 
    277277        sz = fi.Size(63,33) 
    278          
     278 
    279279        imA=fi.FastImage32f(sz) 
    280280        imA.set_val(A,sz) 
     
    294294        B = 3854.2 
    295295        sz = fi.Size(33,63) 
    296          
     296 
    297297        imA=fi.FastImage32f(sz) 
    298298        imA.set_val(A,sz) 
     
    307307        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    308308 
    309          
     309 
    310310    def test_subtract1(self): 
    311311 
     
    313313        B = 3854.2 
    314314        sz = fi.Size(33,323) 
    315          
     315 
    316316        imA=fi.FastImage32f(sz) 
    317317        imA.set_val(A,sz) 
     
    321321 
    322322        imA.toself_subtract(imB,sz) 
    323          
     323 
    324324        arA = A*nx.ones((sz.h, sz.w),nx.float32) 
    325325        arB = B*nx.ones((sz.h, sz.w),nx.float32) 
    326326        arA = arA - arB 
    327327        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    328          
     328 
    329329    def test_subtract2(self): 
    330330 
     
    332332        B = 3854.2 
    333333        sz = fi.Size(33,323) 
    334          
     334 
    335335        imA=fi.FastImage32f(sz) 
    336336        imA.set_val(A,sz) 
     
    340340 
    341341        imC=imA.get_subtracted(imB,sz) 
    342          
     342 
    343343        arA = A*nx.ones((sz.h, sz.w),nx.float32) 
    344344        arB = B*nx.ones((sz.h, sz.w),nx.float32) 
     
    351351        B = 3854.2 
    352352        sz = fi.Size(33,323) 
    353          
     353 
    354354        imA=fi.FastImage32f(sz) 
    355355        imA.set_val(A,sz) 
     
    360360        imC=fi.FastImage32f(sz) 
    361361        imA.get_subtracted_put(imB,imC,sz) 
    362          
     362 
    363363        arA = A*nx.ones((sz.h, sz.w),nx.float32) 
    364364        arB = B*nx.ones((sz.h, sz.w),nx.float32) 
    365365        arC = arA - arB 
    366366        self.assert_( nx.allclose(arC, nx.asarray(imC))) 
    367          
     367 
    368368    def test_from_nx1(self): 
    369369 
     
    371371        sz = fi.Size(33,323) 
    372372        arA = nx.array(A,nx.float32)*nx.ones((sz.h, sz.w),nx.float32) 
    373          
     373 
    374374        imA=fi.asfastimage(arA) 
    375375        arA[1,3:40] = 3024.03 
     
    382382        sz = fi.Size(33,323) 
    383383        arA = nx.array(A,nx.float32)*nx.ones((sz.h, sz.w),nx.float32) 
    384          
     384 
    385385        imA=fi.copy(arA) 
    386386        arA[1,3:40] = 3024.03 
     
    390390    def test_ipow(self): 
    391391        sz = fi.Size(2,2) 
    392          
     392 
    393393        imA=fi.FastImage32f(sz) 
    394394        imA.set_val(2,sz) 
     
    401401        arA **= 0.5 
    402402        self.assert_( nx.allclose(arA, nx.asarray(imA))) 
    403          
     403 
    404404    def test_iadd(self): 
    405405        sz = fi.Size(2,2) 
    406          
     406 
    407407        imA=fi.FastImage32f(sz) 
    408408        imA.set_val(2,sz) 
     
    415415    def test_iconvert(self): 
    416416        sz = fi.Size(2,2) 
    417          
     417 
    418418        imA=fi.FastImage32f(sz) 
    419419 
  • trunk/FlyMovieFormat/scripts/fmf_batch_process.py

    r1 r379  
    11#!/usr/bin/env python 
    22import glob 
    3 import FlyMovieFormat 
     3import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    44 
    55# change this to current filenames 
     
    3030    print '%(input_filename)s (%(in_width)dx%(in_height)d, '\ 
    3131          '%(fmax)d frames) ->'%locals() 
    32      
     32 
    3333    print '    %(output_filename)s (%(width)dx%(height)d, '\ 
    3434          '%(n_output_frames)d frames) :          '%locals(), 
  • trunk/FlyMovieFormat/scripts/plot_timestamps.py

    r1 r379  
    11#!/usr/bin/env python 
    22 
    3 import FlyMovieFormat 
     3import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    44from pylab import * 
    55import sys 
     
    1010n_frames = fly_movie.get_n_frames() 
    1111timestamps = numarray.zeros((n_frames,),type=numarray.Float64) 
    12 for i in xrange(n_frames):  
     12for i in xrange(n_frames): 
    1313    timestamps[i]=fly_movie.get_next_timestamp() 
    1414diff = (timestamps[1:]-timestamps[:-1])*1000.0 
  • trunk/FlyMovieFormat/scripts/truncate_fmf.py

    r1 r379  
    11#!/usr/bin/env python 
    2 import FlyMovieFormat 
     2import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    33 
    44input_filename = '20050304_1834.fmf' 
  • trunk/flytrax/motmot/flytrax/trax_replay.py

    r294 r379  
     1import pkg_resources 
    12import flytrax 
    23try: 
     
    45except ImportError: 
    56    import traxio 
    6 import FlyMovieFormat 
     7import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    78import numpy 
    8 import FastImage 
     9import motmot.FastImage.FastImage as FastImage 
    910import wx 
    1011import wx.xrc as xrc 
    11 import pkg_resources 
    12 import wxglvideo 
    1312import time, Queue, threading, os 
    1413import sys 
     14import motmot.fview.fview_video as video_module 
    1515 
    1616RESFILE = pkg_resources.resource_filename(__name__,"trax_replay.xrc") # trigger extraction 
     
    4040        main_display_panel.SetSizer(box) 
    4141 
    42         self.cam_image_canvas = wxglvideo.DynamicImageCanvas(main_display_panel,-1) 
     42        self.cam_image_canvas = video_module.DynamicImageCanvas(main_display_panel,-1) 
    4343        self.cam_image_canvas.x_border_pixels = 0 
    4444        self.cam_image_canvas.y_border_pixels = 0 
  • trunk/fview/motmot/fview/fview_fmf_replay.py

    r177 r379  
    1 import FlyMovieFormat 
     1import pkg_resources 
     2import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    23import numpy 
    34import wx 
    45import wx.xrc as xrc 
    5 import pkg_resources 
    6 import wxglvideo 
     6import motmot.wxglvideo.wxglvideo as wxglvideo 
    77import time, Queue, threading, os 
    88import sys 
     
    1515 
    1616class ReplayApp(wx.App): 
    17      
     17 
    1818    def OnInit(self,*args,**kw): 
    1919        wx.InitAllImageHandlers() 
    2020        self.frame = RES.LoadFrame(None,"FVIEW_FMF_REPLAY_FRAME") # make frame main panel 
    2121        self.frame.Show() 
    22          
     22 
    2323        self.plugins, plugin_dict = plugin_manager.load_plugins(self.frame) 
    2424 
     
    5353        self.tracker = self.plugins[0] # XXX have better selection mechanism 
    5454        self.tracker.get_frame().Show() 
    55          
     55 
    5656        wx.EVT_CLOSE(self.tracker.get_frame(),self.OnTrackerWindowClose) 
    5757 
     
    7575        except Queue.Empty: 
    7676            pass 
    77          
     77 
    7878##        if tup is not None: 
    7979##            im, points, linesegs = tup 
     
    8585##                                                            linesegs=linesegs, 
    8686##                                                            ) 
    87      
     87 
    8888    def OnLoadFmf(self,event): 
    8989        doit=False 
     
    101101            return 
    102102        self.load_fmf(fmf_filename) 
    103          
     103 
    104104    def load_fmf(self,fmf_filename): 
    105105        fmf = FlyMovieFormat.FlyMovie(fmf_filename)#, check_integrity=True) 
     
    108108        format=fmf.get_format() 
    109109        bg_image,timestamp0 = fmf.get_frame(0) 
    110          
     110 
    111111        self.buf_allocator = None 
    112112        if hasattr(self.tracker,'get_buffer_allocator'): 
    113113            self.buf_allocator = self.tracker.get_buffer_allocator(cam_id) 
    114          
     114 
    115115        self.tracker.camera_starting_notification(cam_id, 
    116116                                                  pixel_format=format, 
    117117                                                  max_width=bg_image.shape[1], 
    118118                                                  max_height=bg_image.shape[0]) 
    119          
     119 
    120120        # save data for processing 
    121121        self.loaded_fmf = dict( fmf=fmf, 
     
    139139                                                        ) 
    140140        self.statusbar.SetStatusText('%s loaded'%(os.path.split(fmf_filename)[1],),0) 
    141          
     141 
    142142    def OnTrackerWindowClose(self,event): 
    143143        pass # don't close window (pointless in trax_replay) 
    144      
     144 
    145145    def OnPlayFrames(self,event): 
    146146        if self.loaded_fmf is None: 
     
    184184                for y in range(h): 
    185185                    npy_buf[y,:iw] = fullsize_image[y,:] 
    186                      
     186 
    187187            points,linesegs = tracker.process_frame(cam_id, 
    188188                                                    buf, 
     
    197197    finally: 
    198198        playing.clear() 
    199              
     199 
    200200def main(): 
    201201    app = ReplayApp(0) 
     
    204204        app.load_fmf(fmf_filename) 
    205205    app.MainLoop() 
    206      
     206 
    207207    if app.loaded_fmf is not None: 
    208208        app.tracker.quit() 
  • trunk/imops/examples/simple.py

    r1 r379  
    11# show mono16 format logic 
    22import numpy 
    3 import imops 
     3import motmot.imops.imops as imops 
    44 
    55h = 2 
  • trunk/motmot_utils/motmot/utils/check_new_namespace.py

    r377 r379  
    1212old_top_level_modules = ['motmot_utils', 
    1313                         'cam_iface', 
    14                          'cam_iface_ctypes', 
    1514                         'FastImage', 
    1615                         'fview_UDP_logger', 
  • trunk/pycamiface/motmot/cam_iface/tests.py

    r240 r379  
    44 
    55if sys.platform.startswith('linux'): 
    6     import cam_iface._cam_iface_shm as cishm 
     6    import motmot.cam_iface._cam_iface_shm as cishm 
    77 
    88class TestWrapper(unittest.TestCase): 
     
    1515 
    1616    def _get_cam_iface(self): 
    17         import cam_iface_ctypes as cam_iface 
     17        import cam_iface_ctypes as cam_iface # relative import 
    1818        return cam_iface 
    19          
     19 
    2020    def _get_cam(self,device_num=0): 
    2121        cam_iface = self._get_cam_iface() 
     
    8282        assert numpy.allclose( result_preallocated, fake_image ) 
    8383        assert result_preallocated2 is result_preallocated 
    84          
     84 
    8585def get_test_suite(): 
    8686    suites = [ 
  • trunk/realtime_image_analysis/motmot/realtime_image_analysis/tests.py

    r165 r379  
    11import unittest 
    2 import realtime_image_analysis as ria 
    3 import FastImage 
     2import motmot.realtime_image_analysis.realtime_image_analysis as ria 
     3import motmot.FastImage.FastImage as FastImage 
    44import numpy 
    55 
     
    2121        roi_im=FastImage.FastImage8u(sz) 
    2222        self.ra.do_work(roi_im,timestamp,framenumber,use_roi2,use_cmp) 
    23          
     23 
    2424    def test_basic_roi2(self): 
    2525        timestamp = 0.0 
     
    3939        roi_im=FastImage.FastImage8u(sz) 
    4040        self.ra.do_work(roi_im,timestamp,framenumber,use_roi2,use_cmp) 
    41          
     41 
    4242    def test_variance_roi2(self): 
    4343        timestamp = 0.0