Esempio n. 1
0
    def load_from_matlab_files( self, index_fname=None,
                                generators_fname=None,
                                matname=None):
        """
        index_fname : path to matrix of map on generators (may have to
        provide internal name of the matlab matrix to extract it from
        meta data. See example below. )

        generators_fname : path to the region --> geneators map.

        Example:
        --------

           hom_matrix = utils.load_matlab_matrix( 'henon_index.mat', 'hom_matrix' )
           region2gen = utils.convert_matlab_gens( 'henon_gens.mat' )
           map_on_regions = utils.index_map_to_region_map( hom_matrix, region2gen, shift=-1)
        """
        self.index_fname = index_fname
        self.generators_fname = generators_fname
        self.index_map = utils.load_matlab_matrix( self.index_fname, matname )
        self.region2gen = utils.convert_matlab_gens( self.generators_fname )
Esempio n. 2
0
#print "Drawing all verified semi-conjugate subshifts..."
#re1.draw()

print ""

## EXPECTED OUTPUT for Leslie map files
# >>> Testing with Numpy matices...
# >>> Maximum entropy found:  0.150632111601


##############################
# test matlab functionality
##############################

# load from matrix and dict
print "Testing ability to start off with Matlab matrices..." 
hom_matrix = utils.load_matlab_matrix( fname_mat, matname )
region2gen = utils.convert_matlab_gens( reg_mat )

re2 = RigorousEntropy( index_map=hom_matrix,
                       reg2gen=region2gen )    
re2.prepare_regions()

# drawing the map on regions
print "Drawing the maps on strongly connected components (disjoint regions in the MVM)...\n"
fig = re2.map_on_regions.draw()

re2.compute_entropy()
re2.get_max_entropy()

Esempio n. 3
0
import sys
import numpy as np
from rads.misc import utils
from rads.symbolics.sofic_processor import SoficProcessor

if len(sys.argv) < 3:
    print "usage: python test_sofic.py <data file> [<index_map> <generators>]"
    print "where <index_map> and <generators> default to M and G"
    genn = 'G'
    mapn = 'M'
else:
    genn = sys.argv[2]
    mapn = sys.argv[3]
filename = sys.argv[1]

gens = utils.convert_matlab_gens( filename, genname=genn )
index_map = utils.load_matlab_matrix( filename, matname=mapn ).astype(int)
sof = SoficProcessor( index_map, gens, debug=False )
sof.process()
print sof
print sof.entropy()


# for i in range(ca.shape[0]):
#     gens = utils.cell2dict(ca[i,0])
#     sof = SoficProcessor(ca[i,1],gens)
#     sof.process()
#     print sof
#     print sof.entropy()

# ca = utils.load_matlab_matrix( '/home/raf/Dropbox/henon-tipping-14-run-goodruns.mat', matname='e' )
Esempio n. 4
0
    region2gen = { 0 : [0,1],
                   1 : [2],
                   2 : [3,4]
                   }

    symbols = numpy.matrix( [[0,1,1],
                             [1,0,0],
                             [0,1,1]]
                            )
    map_on_regions = DiGraph()
    map_on_regions.from_numpy_matrix( symbols )

if 1:

    hom_matrix = utils.load_matlab_matrix( 'henon_index.mat', 'hom_matrix' )
    region2gen = utils.convert_matlab_gens( 'henon_gens.mat' )
    map_on_regions = utils.index_map_to_region_map( hom_matrix, region2gen, shift=-1)

if 0:
    hom_matrix = utils.load_matlab_matrix( 'leslie_index.mat', 'hom_matrix' )
    region2gen = utils.convert_matlab_gens( 'leslie_gens.mat' )
    map_on_regions = utils.index_map_to_region_map( hom_matrix, region2gen, shift=-1)


    ########################
    #  
    # APPEARS THAT BAD EDGE SETS ARE BEING THROWN INTO ONE (1) SET. CHECK THIS!!
    #
    ########################

debug = True