Changeset 362

Show
Ignore:
Timestamp:
12/29/07 13:21:57 (10 months ago)
Author:
astraw
Message:

more fixes of motmot namespace

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/FastImage/motmot.FastImage.egg-info/stdeb.cfg

    r186 r362  
    1 [FastImage] 
    2 Package: python-fastimage 
    3 Build-Depends: python-pyrex, libipp-dev, python-motmotutils 
     1[DEFAULT] 
     2Depends: libipp, python-numpy 
     3Build-Depends: python-pyrex, libipp-dev 
     4Build-Conflicts: python-fastimage 
  • trunk/FastImage/setup.py

    r361 r362  
    1 import glob, os 
    2 from setuptools import setup, find_packages 
    3 from distutils.extension import Extension 
     1import os, sys 
     2from setuptools import setup, find_packages, Extension 
    43 
    5 import FastImage_util 
    6 vals = FastImage_util.get_build_info() 
     4# I need to import a module I'm about to install. How naughty is this? 
     5sys.path.insert(0, os.path.abspath(os.path.join('motmot','FastImage'))) 
     6import util as FastImage_util 
     7 
     8vals = FastImage_util.get_build_info(ipp_static=False) 
    79 
    810ipp_sources = vals.get('ipp_sources',[]) 
     
    2224      license="BSD", 
    2325      version='0.5.2', 
    24       namespace_package=['motmot'], 
     26      namespace_packages=['motmot'], 
    2527      packages = find_packages(), 
    2628      ext_modules=[Extension(name="motmot.FastImage.FastImage", 
  • trunk/flytrax/motmot.flytrax.egg-info/stdeb.cfg

    r331 r362  
    11[DEFAULT] 
    2 Package: python-motmot-flytrax 
    32Depends: python-motmot-fview, python-motmot-realtimeimageanalysis, python-motmot-wxvideo, python-motmot-wxvalidatedtext, python-scipy 
  • trunk/flytrax/motmot/flytrax/flytrax.py

    r294 r362  
    2323 
    2424import sys, threading, Queue, time, socket, math, struct, os 
     25import pkg_resources 
    2526import traxio 
    2627 
     
    3233import motmot.wxvideo.wxvideo as wxvideo 
    3334import motmot.imops.imops as imops 
    34 import FastImage 
    35  
    36 import realtime_image_analysis 
    37  
    38 import pkg_resources 
     35import motmot.FastImage.FastImage as FastImage 
     36 
     37import motmot.realtime_image_analysis.realtime_image_analysis as realtime_image_analysis 
     38 
    3939import numpy 
    4040 
    41 import wxvalidatedtext as wxvt 
     41import motmot.wxvalidatedtext.wxvalidatedtext as wxvt 
    4242 
    4343import wx 
  • trunk/flytrax/motmot/flytrax/traxio.py

    r294 r362  
    1 import FlyMovieFormat 
     1import motmot.FlyMovieFormat.FlyMovieFormat as FlyMovieFormat 
    22import numpy as nx 
    33from numpy import nan 
     
    1818        version 2 does save area 
    1919        """ 
    20          
     20 
    2121        data_fname = fname_prefix+'.trx' 
    2222        self.data_fd = open(data_fname,'wb') 
    2323        bgimage = nx.asarray(bgimage) 
    24          
     24 
    2525        assert len(bgimage.shape)==2 
    2626        assert bgimage.dtype==nx.dtype(nx.uint8) 
     
    2828        assert version in VALID_VERSIONS 
    2929        self.version = version 
    30          
     30 
    3131        self.data_fd.write( struct.pack(header_fmt, 
    3232                                        self.version, 
     
    3737        fmf_fname = fname_prefix + '.fmf' 
    3838        self.fmf = FlyMovieFormat.FlyMovieSaver( fmf_fname) 
    39          
     39 
    4040    def close(self): 
    4141        self.fmf.close() 
     
    113113            f1.data_fd.truncate() 
    114114        f1.close() 
    115          
     115 
    116116        im,rows=readtrax(fname+'.trx') 
    117117    finally: 
    118118        shutil.rmtree(dirname) 
    119              
     119 
    120120    assert nx.allclose(im,a) 
    121121    assert nx.allclose(r1,rows[0]) 
     
    130130    print 'all_vals[0]',all_vals[0] 
    131131    print 'all_vals[-1]',all_vals[-1] 
    132      
     132 
    133133    fmf = FlyMovieFormat.FlyMovie(fmf_fname,check_integrity=True) 
    134134    print 'fmf.get_n_frames()',fmf.get_n_frames() 
     
    146146    def test_fmt2(self): 
    147147        test_version(2) 
    148          
     148 
    149149    def test_fmt1_incomplete(self): 
    150150        test_version(1,incomplete=True) 
  • trunk/flytrax/setup.py

    r294 r362  
    99     url='http://code.astraw.com/projects/motmot', 
    1010     entry_points = { 
    11        'cam_iface.fview_plugins':'flytrax = motmot.flytrax.flytrax:Tracker', 
     11       'motmot.fview.plugins':'flytrax = motmot.flytrax.flytrax:Tracker', 
    1212       'console_scripts': [ 
    1313           'flytrax_print_info = motmot.flytrax.traxio:print_info_main', 
  • trunk/fview/motmot/fview/plugin_manager.py

    r177 r362  
    1111        modules = [] 
    1212 
    13         for name in egg.get_entry_map('cam_iface.fview_plugins'): 
     13        for name in egg.get_entry_map('motmot.fview.plugins'): 
    1414            egg.activate() 
    15             entry_point = egg.get_entry_info('cam_iface.fview_plugins', name) 
     15            entry_point = egg.get_entry_info('motmot.fview.plugins', name) 
    1616            if entry_point.module_name not in loaded_components: 
    1717                try: 
     
    2222                    else: 
    2323                        import warnings 
    24                         warnings.warn('could not load plugin %s: %s'%(str(entry_point),str(x))) 
     24                        warnings.warn('could not load plugin (set env var FVIEW_RAISE_ERRORS to raise error) %s: %s'%(str(entry_point),str(x))) 
    2525                        continue 
    2626                PluginClasses.append( PluginClass ) 
  • trunk/realtime_image_analysis/motmot.realtime_image_analysis.egg-info/stdeb.cfg

    r208 r362  
    1 [realtime_image_analysis] 
    2 Source: python-realtimeimageanalysis 
    3 Package: python-realtimeimageanalysis 
    4 Build-Depends: python-fastimage, libipp-dev, python-motmotutils, python-pyrex, python-numpy 
    5 Depends: python-fastimage, python-numpy 
     1[DEFAULT] 
     2Build-Depends: python-motmot-fastimage, libipp-dev, python-pyrex, python-numpy, python-setuptools 
     3Depends: python-motmot-fastimage, python-numpy 
  • trunk/realtime_image_analysis/motmot/realtime_image_analysis/__init__.py

    r93 r362  
    1 from _realtime_image_analysis import * 
  • trunk/realtime_image_analysis/setup.py

    r209 r362  
    11import os 
    2 from setuptools import setup, Extension 
     2from setuptools import setup, Extension, find_packages 
     3import pkg_resources # make sure FastImage is importable 
    34 
    4 install_requires = ['FastImage'] 
    5  
    6 import FastImage 
     5import motmot.FastImage.FastImage as FastImage 
    76major,minor,build = FastImage.get_IPP_version() 
    8 import FastImage_util 
     7import motmot.FastImage.util as FastImage_util 
    98 
    109# build with same IPP as FastImage 
     
    2625if 1: 
    2726    # Pyrex build of realtime_image_analysis 
    28     realtime_image_analysis_extension_name='_realtime_image_analysis' 
    29     realtime_image_analysis_sources=['src/_realtime_image_analysis.pyx', 
     27    realtime_image_analysis_sources=['src/realtime_image_analysis.pyx', 
    3028                                     'src/c_fit_params.c', 
    3129                                     'src/eigen.c', 
    3230                                     'src/c_time_time.c', 
    3331                                     ]+ipp_sources 
    34     ext_modules.append(Extension(name=realtime_image_analysis_extension_name
     32    ext_modules.append(Extension(name='motmot.realtime_image_analysis.realtime_image_analysis'
    3533                                 sources=realtime_image_analysis_sources, 
    3634                                 include_dirs=ipp_include_dirs, 
     
    4139                                 extra_compile_args=ipp_extra_compile_args, 
    4240                                 )) 
    43      
    44 if os.name.startswith('posix'): 
    45     install_requires.append('posix_sched') 
    4641 
    47 setup(name='realtime_image_analysis', 
     42setup(name='motmot.realtime_image_analysis', 
    4843      description="several image analysis functions that require Intel IPP and FastImage", 
    4944      long_description= 
     
    5752      url='http://code.astraw.com/projects/motmot', 
    5853      license='BSD', 
    59       packages = ['realtime_image_analysis']
     54      packages = find_packages()
    6055      ext_modules= ext_modules, 
    61       install_requires = install_requires, 
    6256      zip_safe = True, 
    6357      ) 
  • trunk/realtime_image_analysis/src/realtime_image_analysis.pyx

    r119 r362  
    1818import numpy.dual 
    1919 
    20 cimport FastImage 
    21 import FastImage 
     20#cimport FastImage 
     21cimport motmot.FastImage.FastImage as FastImage 
     22import motmot.FastImage.FastImage as FastImage 
    2223 
    2324cdef double nan 
     
    3334cdef extern from "unistd.h": 
    3435    ctypedef long intptr_t 
    35          
     36 
    3637cdef extern from "c_fit_params.h": 
    3738    ctypedef enum CFitParamsReturnType: 
     
    5859cdef extern from "c_time_time.h": 
    5960    double time_time() 
    60      
     61 
    6162cdef void CHK_HAVEGIL( ipp.IppStatus errval ) except *: 
    6263    if (errval != ipp.ippStsNoErr): 
     
    9899    L = nx.dot(A,nx.transpose(B)) - nx.dot(B,nx.transpose(A)) 
    99100    return Lmatrix2Lcoords(L) 
    100      
     101 
    101102cdef class RealtimeAnalyzer: 
    102103 
     
    110111 
    111112    cdef double _scale_factor 
    112      
     113 
    113114    # runtime parameters 
    114115    cdef ipp.Ipp8u _diff_threshold 
    115116    cdef float _clear_threshold 
    116      
     117 
    117118    # calibration matrix 
    118119    cdef object _pmat, _pmat_inv, camera_center # numpy ndarrays 
     
    122123 
    123124    cdef ipp.Ipp8u _despeckle_threshold 
    124      
     125 
    125126    cdef FastImage.Size _roi_sz 
    126          
     127 
    127128    cdef int n_rot_samples 
    128129 
     
    133134    # input image size. The roi is a view of the active part. The roi2 
    134135    # is a view of the sub-region of the active part. 
    135      
     136 
    136137    cdef FastImage.FastImage8u absdiff_im, cmpdiff_im # also raw_im 
    137138 
     
    174175        self._diff_threshold = 11 
    175176        self._clear_threshold = 0.2 
    176          
     177 
    177178        self._pmat = None 
    178179        self._pmat_inv = None 
    179180        self._set_pmat = False 
    180          
     181 
    181182        self.camera_center = None 
    182183        self.camera_center_meters = None 
    183          
     184 
    184185        self._pmat_meters_inv = None 
    185186 
     
    198199        self.mask_im=FastImage.FastImage8u(sz) 
    199200        self.mask_im.set_val(0,sz) 
    200          
     201 
    201202        self.mean_im=FastImage.FastImage8u(sz) 
    202203        self.cmp_im=FastImage.FastImage8u(sz) 
    203204        self.cmpdiff_im=FastImage.FastImage8u(sz) 
    204          
     205 
    205206        # create and update self.imname2im dict 
    206207        self.imname2im = {'absdiff' :self.absdiff_im, 
     
    212213 
    213214        self.roi = lbrt 
    214          
     215 
    215216        # initialize background images 
    216217        self.mean_im_roi_view.set_val( 0, self._roi_sz ) 
     
    218219    def set_reconstruct_helper( self, helper ): 
    219220        self._helper = helper 
    220          
     221 
    221222    def get_pmat(self): 
    222223        return self._pmat 
    223      
     224 
    224225    def set_pmat(self,value): 
    225226        self._pmat = nx.asarray(value) 
     
    277278        inputs 
    278279        ------ 
    279          
     280 
    280281        timestamp 
    281282        framenumber 
     
    289290        outputs 
    290291        ------- 
    291          
     292 
    292293        [ (x0_abs, y0_abs, area, slope, eccentricity, p1, p2, p3, p4) ] 
    293          
     294 
    294295        """ 
    295296        cdef double x0, y0 
     
    302303        cdef double evalA, evalB 
    303304        cdef double evecA1, evecB1 
    304          
     305 
    305306        cdef double Mu00, Uu11, Uu02, Uu20 
    306307        cdef int i 
    307308        cdef int result, eigen_err 
    308          
     309 
    309310        cdef int index_x,index_y 
    310          
     311 
    311312        cdef ipp.Ipp8u max_val 
    312313        cdef ipp.Ipp8u* max_val_ptr 
    313314        cdef ipp.Ipp8u max_std_diff 
    314          
     315 
    315316        cdef ipp.Ipp8u clear_despeckle_thresh 
    316317 
    317318        cdef FastImage.Size roi2_sz 
    318319        cdef int left2, right2, bottom2, top2 
    319          
     320 
    320321        cdef int found_point 
    321322        cdef int n_found_points 
     
    330331 
    331332        roi2_sz = FastImage.Size(21,21) 
    332          
     333 
    333334        all_points_found = [] # len(all_points_found) == n_found_points 
    334335        n_found_points = 0 
     
    351352                                          <ipp.Ipp8u*>self.absdiff_im_roi_view.im,self.absdiff_im_roi_view.step, 
    352353                                          self._roi_sz.sz)) 
    353         
     354 
    354355        # mask unused part of absdiff_im to 0 
    355356        #self.absdiff_im.fast_set_val_masked( 0, 
     
    359360        CHK_NOGIL( ipp.ippiSet_8u_C1MR( 0, <ipp.Ipp8u*>self.absdiff_im.im, self.absdiff_im.step, self.absdiff_im.imsiz.sz, 
    360361                                        <ipp.Ipp8u*>self.mask_im.im, self.mask_im.step)) 
    361          
     362 
    362363        if use_cmp: 
    363364            # clip the minimum comparison value to diff_threshold 
     
    520521                if not (n_found_points+1==self.max_num_points): # only modify the image if more follow... 
    521522                    self.absdiff_im_roi2_view.set_val(0, roi2_sz ) 
    522                          
     523 
    523524            if return_first_xy: 
    524525                #nominal: (x0_abs, y0_abs, area, slope, eccentricity, p1, p2, p3, p4, line_found, slope_found) 
    525526                rval = [(index_x, index_y, max_std_diff, max_val, eccentricity, p1, p2, p3, p4, 0, found_point)] 
    526527                return rval 
    527              
     528 
    528529            if not found_point: 
    529530                break 
     
    570571                x0u = x0_abs # fake undistorted data 
    571572                y0u = y0_abs 
    572                  
     573 
    573574                p1,p2,p3,p4 = -1, -1, -1, -1 # sentinel value (will be converted to nan) 
    574575                line_found = False 
     
    585586            if c_lib.isinf(eccentricity): 
    586587                eccentricity = near_inf 
    587                  
     588 
    588589            if c_lib.isinf(slope): 
    589590                slope = near_inf 
    590                  
     591 
    591592            all_points_found.append( 
    592593                (x0_abs, y0_abs, area, slope, eccentricity, 
     
    603604        im = self.imname2im[which] 
    604605        return im 
    605      
     606 
    606607    property roi2_radius: 
    607608        def __get__(self): 
     
    609610        def __set__(self,value): 
    610611            self._roi2_radius = value 
    611          
     612 
    612613    property clear_threshold: 
    613614        def __get__(self): 
     
    615616        def __set__(self,value): 
    616617            self._clear_threshold = value 
    617          
     618 
    618619    property diff_threshold: 
    619620        def __get__(self): 
     
    621622        def __set__(self,value): 
    622623            self._diff_threshold = value 
    623          
     624 
    624625    property scale_factor: 
    625626        def __get__(self): 
     
    628629            print 'setting scale_factor to',value 
    629630            self._scale_factor = value 
    630                          
     631 
    631632    property roi: 
    632633        def __get__(self): 
     
    634635        def __set__(self,object lbrt): 
    635636            cdef int l,b,r,t 
    636              
     637 
    637638            l,b,r,t = lbrt 
    638639            if (l==self._left and b==self._bottom and 
     
    640641                # nothing to do 
    641642                return 
    642              
     643 
    643644            self._left = l 
    644645            self._bottom = b 
     
    656657 
    657658            self._roi_sz = FastImage.Size( self._right-self._left+1, self._top-self._bottom+1 ) 
    658              
     659 
    659660            self.absdiff_im_roi_view = self.absdiff_im.roi(self._left,self._bottom,self._roi_sz) 
    660661            self.mean_im_roi_view = self.mean_im.roi(self._left,self._bottom,self._roi_sz) 
     
    694695    running_mean8u_im.get_compare_put( 200, noisy_pixels_mask, max_frame_size, FastImage.CmpGreater) 
    695696    compareframe8u.set_val_masked(25, noisy_pixels_mask, max_frame_size) 
    696                              
    697              
     697 
     698 
    698699def bg_help( FastImage.FastImage32f running_mean_im, 
    699700             FastImage.FastImage32f fastframef32_tmp, 
     
    715716                                               <ipp.Ipp32f*>running_mean_im.im, running_mean_im.step, 
    716717                                               max_frame_size.sz, ALPHA)) 
    717      
     718 
    718719    # maintain 8bit unsigned background image 
    719720    #running_mean_im.fast_get_8u_copy_put( running_mean8u_im, max_frame_size ) # done 
     
    722723        <ipp.Ipp8u*>running_mean8u_im.im,running_mean8u_im.step, 
    723724        max_frame_size.sz, ipp.ippRndNear )) 
    724      
     725 
    725726    # standard deviation calculation 
    726727    #hw_roi_frame.fast_get_32f_copy_put(fastframef32_tmp,max_frame_size) # done 
     
    728729                                         <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, 
    729730                                         max_frame_size.sz )) 
    730      
     731 
    731732    #fastframef32_tmp.fast_toself_square(max_frame_size) # current**2 # done 
    732733    CHK_NOGIL( ipp.ippiSqr_32f_C1IR( <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, 
    733734                                     max_frame_size.sz)) 
    734      
     735 
    735736    #running_sumsqf.fast_toself_add_weighted_32f( fastframef32_tmp, max_frame_size, ALPHA) # done 
    736737    CHK_NOGIL( ipp.ippiAddWeighted_32f_C1IR( <ipp.Ipp32f*>fastframef32_tmp.im, fastframef32_tmp.step, 
     
    746747                                   <ipp.Ipp32f*>running_stdframe.im, running_stdframe.step, 
    747748                                   max_frame_size.sz)) 
    748      
     749 
    749750    # now create frame for comparison 
    750751    #running_stdframe.fast_toself_multiply(C,max_frame_size) # done 
     
    756757        <ipp.Ipp8u*>compareframe8u.im,compareframe8u.step, 
    757758        max_frame_size.sz, ipp.ippRndNear )) 
    758      
     759 
    759760    # now we do hack, erm, heuristic for bright points, which aren't gaussian. 
    760761    #running_mean8u_im.fast_get_compare_int_put_greater( 200, noisy_pixels_mask, max_frame_size) 
     
    764765                                        max_frame_size.sz, 
    765766                                        ipp.ippCmpGreater)) 
    766      
     767 
    767768    #compareframe8u.fast_set_val_masked(25, noisy_pixels_mask, max_frame_size) # done 
    768769    CHK_NOGIL( ipp.ippiSet_8u_C1MR( 25, <ipp.Ipp8u*>compareframe8u.im, compareframe8u.step, max_frame_size.sz, 
     
    876877    return res 
    877878 
    878      
     879 
  • trunk/trackem/motmot.trackem.egg-info/stdeb.cfg

    r329 r362  
    11[DEFAULT] 
    2 Package: python-motmot-trackem 
    32Depends: python-motmot-fview, python-motmot-fastimage, python-motmot-wxvalidatedtext, python-numpy, python-motmot-imops, python-motmot-flytrax 
  • trunk/trackem/motmot/trackem/trackem.py

    r294 r362  
    55import wx 
    66from wx import xrc 
    7 import FastImage 
     7import motmot.FastImage.FastImage as FastImage 
    88import numpy 
    9 import wxvalidatedtext as wxvt 
     9import motmot.wxvalidatedtext.wxvalidatedtext as wxvt 
    1010import os, sys, socket, signal, time, math, threading, Queue 
    1111import motmot.flytrax.flytrax as flytrax 
  • trunk/trackem/setup.py

    r294 r362  
    55      version='0.4.1', 
    66      entry_points = { 
    7     'cam_iface.fview_plugins':'trackem = motmot.trackem.trackem:TrackemClass', 
     7    'motmot.fview.plugins':'trackem = motmot.trackem.trackem:TrackemClass', 
    88    }, 
    99      namespace_packages = ['motmot'], 
  • trunk/wxvideo/motmot.wxvideo.egg-info/stdeb.cfg

    r177 r362  
    1 [wxvideo] 
    2 Package: python-wxvideo 
    3 Conflicts: python-ads-wxvideo 
    4 Replaces: python-ads-wxvideo 
    5 Depends: python-imops 
    6 Build-Depends: python-motmotutils 
     1[DEFAULT] 
     2# should probably depend on wxpython 
     3Depends: python-motmot-imops