str_xordFile = '%s.xord' % str_stem str_yordFile = '%s.yord' % str_stem # We need to setup the grid with the proper size, which # is a slight chicken-and-egg problem. First, we read # one of the ord files, determine the string length # and there we go :-) if not count: f = open(str_xordFile) str_file = f.readline() str_xord = str_file.splitlines()[0] gridSize = len(str_xord) l_keys = list(str_xord) l_keys.sort() f.close() gridSpect = spectrum.C_spectrum(l_keys) Cg = grid.C_ggrid(str_gridFile, gridSpect) print Cg if not count: Cg_sum = Cg Csp_xord = spectrum.C_spectrum_permutation(Cg_sum.cols_get()) Csp_xord.printAsHistogram_set(True) Csp_xord.name_set('X-ordering') Csp_yord = spectrum.C_spectrum_permutation(Cg_sum.cols_get()) Csp_yord.printAsHistogram_set(True) Csp_yord.name_set('Y-ordering') Csp_xyord = spectrum.C_spectrum_permutation2D(Cg_sum.cols_get()) Csp_xyord.printAsHistogram_set(True) Csp_xyord.name_set('XY-ordering') Csp_xyord.printConcise_set(True) else:
# # A simple 'driver' for a C_genome class instance # # HISTORY # # 25 March 2011 # o Initial development implementation. # from numpy import * from C_spectrum import * C_t = C_spectrum_color(['r', 'g', 'b', 'y']) C_t.component_add('b') C_s = C_spectrum(['1', '2', '3']) print C_s a = array((1, 1, 1, 2, 5, 10, 5, 2, 1, 1, 1)) C_sa = C_spectrum(a) C_sa.component_add(2) print C_sa.arr_get() C_sp = C_spectrum_color() C_sp.component_add('red') C_sp.component_add('red') C_sp.component_add(2) C_sp.component_add(0) C_sp2a = C_spectrum_color((4, )) C_sp2b = C_spectrum_color((1, ))
# DESCRIPTION # # A simple 'driver' for a C_genome class instance # # HISTORY # # 07 December 2011 # o Initial development implementation. # from numpy import * from C_ggrid import * from C_spectrum import * import copy Csp = C_spectrum(['R', 'G', 'B']); Csp.component_add('R'); Csp.component_add('G'); Csp.component_add('B'); print Csp Cg0 = C_ggrid(2, Csp, name='Cg0'); Cg1 = C_ggrid(np.array((2,2)), Csp, name='Cg1') Cg00 = copy.deepcopy(Cg0) ; Cg00.mstr_name = 'Cg00' print Cg0 print Cg00 Cg2 = Cg0 + Cg1 print Cg2
# # 25 March 2011 # o Initial development implementation. # from numpy import * from C_spectrum import * C_t = C_spectrum_color(['r', 'g', 'b', 'y']) C_t.component_add('b') C_s = C_spectrum(['1', '2', '3']) print C_s a = array( (1, 1, 1, 2, 5, 10, 5, 2, 1, 1, 1)) C_sa = C_spectrum(a) C_sa.component_add(2) print C_sa.arr_get() C_sp = C_spectrum_color() C_sp.component_add('red') C_sp.component_add('red') C_sp.component_add(2) C_sp.component_add(0) C_sp2a = C_spectrum_color((4,)) C_sp2b = C_spectrum_color((1,)) C_spA = C_sp2a + C_sp2a + C_sp2a + C_sp2a + C_sp2a + C_sp2b + C_sp2b #C_spA.printConcise_set(True) C_spA.printAsRow_set(True) print C_spA