Пример #1
0
def monitor(expFile,convFile):
  g = Gnuplot.Gnuplot()
  gd = Gnuplot.Data
  g('set grid')
  g('set xzeroaxis -1')
  g('set xrange [0:12]')

  e,d,r = io.load(expFile)

  next = ''
  print "q to quit."
  while next != 'q' :
    E,D,R = io.load(convFile)
    g.plot(gd(e,d,with='p pt 9 lt -1'))
Пример #2
0
 def exec_msa(self):
     """ Busca entre los perfiles disponibles el primero que
     cumpla el criterio de rigidez """
     print
     print ">> Guardando los datos de definicion de la estructura... "
     self.save_file(self.filename)
     print ">> Leyendo los datos de definicion de la estructura... "
     (self.joints, self.members, properties) = io.load(self.filename)
     print ">> Dimensionando los perfiles de la estructura... "
     msa2d.search(self.joints, self.members, properties)
     print
     #---
     file = open(self.filename, "r")
     rows = file.readlines()
     file.close()
     #---
     content = ""
     n = 0
     for row in rows:
         row = row.replace(',', '.')
         values = row.split(';')
         if re.search('^B\d+', values[0]):
             type = values[4]
             type = self.members[n].type
             n = n + 1
         content += ";".join(values)
Пример #3
0
 def exec_msa(self):
     """ Busca entre los perfiles disponibles el primero que
     cumpla el criterio de rigidez """
     print
     print ">> Guardando los datos de definicion de la estructura... "
     self.save_file(self.filename)
     print ">> Leyendo los datos de definicion de la estructura... "
     (self.joints, self.members, properties) = io.load(self.filename)
     print ">> Dimensionando los perfiles de la estructura... "
     msa2d.search(self.joints, self.members, properties)
     print
     #---
     file = open(self.filename, "r")
     rows = file.readlines()
     file.close()
     #---
     content = ""
     n = 0
     for row in rows:
         row = row.replace(',', '.')
         values = row.split(';')
         if re.search('^B\d+', values[0]):
             type = values[4]
             type = self.members[n].type
             n = n + 1
         content += ";".join(values)
Пример #4
0
    def load_data(self, force=False):
        file_changed = False
        if not self.data_loaded or force:
            logger.debug('loading data from file: %s' % self.abspath)

            for itr, tr in enumerate(
                    io.load(self.abspath,
                            format=self.format,
                            getdata=True,
                            substitutions=self.substitutions)):
                if itr < len(self.traces):
                    xtr = self.traces[itr]
                    if xtr.mtime != tr.mtime or xtr.tmin != tr.tmin or xtr.tmax != tr.tmax:
                        logger.warn(
                            'file may have changed since last access (trace number %i has changed): %s'
                            % (itr, self.abspath))
                        self.remove(xtr)
                        self.traces.remove(xtr)
                        xtr.file = None
                        self.traces.append(tr)
                        self.add(tr)
                        tr.file = self
                        file_changed = True
                    else:
                        xtr.ydata = tr.ydata

                else:
                    self.traces.add(tr)
                    self.add(tr)
                    logger.warn(
                        'file may have changed since last access (new trace found): %s'
                        % self.abspath)
                    file_changed = True
            self.data_loaded = True
        return file_changed
Пример #5
0
 def load_data(self, force=False):
     file_changed = False
     if not self.data_loaded or force:
         logger.debug('loading data from file: %s' % self.abspath)
         
         for itr, tr in enumerate(io.load(self.abspath, format=self.format, getdata=True, substitutions=self.substitutions)):
             if itr < len(self.traces):
                 xtr = self.traces[itr]
                 if xtr.mtime != tr.mtime or xtr.tmin != tr.tmin or xtr.tmax != tr.tmax:
                     logger.warn('file may have changed since last access (trace number %i has changed): %s' % (itr, self.abspath))
                     self.remove(xtr)
                     self.traces.remove(xtr)
                     xtr.file = None
                     self.traces.append(tr)
                     self.add(tr)
                     tr.file = self
                     file_changed = True
                 else:
                     xtr.ydata = tr.ydata
                 
             else:
                 self.traces.add(tr)
                 self.add(tr)
                 logger.warn('file may have changed since last access (new trace found): %s' % self.abspath)
                 file_changed = True
         self.data_loaded = True
     return file_changed
Пример #6
0
 def load_data(self, force=False):
     if not self.data_loaded or force:
         logger.debug('loading data from file: %s' % self.abspath)
         self.traces = []
         for tr in io.load(self.abspath, format=self.format, getdata=True, substitutions=self.substitutions):
             self.traces.append(tr)
             
         self.data_loaded = True
Пример #7
0
 def load_headers(self, mtime=None):
     logger.debug('loading headers from file: %s' % self.abspath)
     if mtime is None:
         self.mtime = os.stat(self.abspath)[8]
     
     self.traces = []
     for tr in io.load(self.abspath, format=self.format, getdata=False, substitutions=self.substitutions):
         self.traces.append(tr)
         
     self.data_loaded = False
     self.data_use_count = 0
Пример #8
0
    def load_data(self, force=False):
        if not self.data_loaded or force:
            logger.debug('loading data from file: %s' % self.abspath)
            self.traces = []
            for tr in io.load(self.abspath,
                              format=self.format,
                              getdata=True,
                              substitutions=self.substitutions):
                self.traces.append(tr)

            self.data_loaded = True
Пример #9
0
def get_sim(path='.'):
    """Returns simulation object from 'path/.pc/' if already existing."""
    if __exists__(__join__(path, '.pc/sim.pkl')):
        return io.load('sim', folder='.pc')
    else:
        from pencilnew import __is_sim_dir__
        if __is_sim_dir__(path):
            return sim.Simulation(path)
        else:
            print('?? WARNING: No simulation found in ' + path +
                  '>. Try get_sims maybe?')
            return False
Пример #10
0
    def load_headers(self, mtime=None):
        logger.debug('loading headers from file: %s' % self.abspath)
        if mtime is None:
            self.mtime = os.stat(self.abspath)[8]

        self.traces = []
        for tr in io.load(self.abspath,
                          format=self.format,
                          getdata=False,
                          substitutions=self.substitutions):
            self.traces.append(tr)

        self.data_loaded = False
        self.data_use_count = 0
Пример #11
0
def convolveDOS(dosFiles,resFile):
  D = []
  for i in dosFiles:
    D.append( read(filename=i) )

  import io
  Res = io.load(resFile)

  R = []
  for d in range(len(D)):
    er,rr = convolve(D[d],Res)
    R.append( (er,rr) )
    io.write( er, rr, numpy.zeros(rr.shape), dosFiles[d]+".conv" )
  return
Пример #12
0
    def show_schematic(self):
        """ Guarda los datos y muestra el esquema estructural """
        self.text_frame.lower()
        self.button_schematic.lower()
        self.plot_frame.lift()
        self.button_editor.lift()
        
        self.save_file(name = self.filename)
        
        (self.joints, self.members, properties) = io.load(self.filename)

        self.fig.clear()
        draw2d.show_schematic(self.joints, self.members)
        draw2d.draw_loads(self.joints, self.members)
        self.canvas.show()
Пример #13
0
    def show_schematic(self):
        """ Guarda los datos y muestra el esquema estructural """
        self.text_frame.lower()
        self.button_schematic.lower()
        self.plot_frame.lift()
        self.button_editor.lift()

        self.save_file(name=self.filename)

        (self.joints, self.members, properties) = io.load(self.filename)

        self.fig.clear()
        draw2d.show_schematic(self.joints, self.members)
        draw2d.draw_loads(self.joints, self.members)
        self.canvas.show()
Пример #14
0
 def solve_msa(self):
     """ Resuelve la estructura por el metodo de la rigidez """
     print
     t0 = time.clock()
     print ">> Guardando los datos de definicion de la estructura... "
     self.save_file(self.filename)
     print ">> Leyendo los datos de definicion de la estructura... "
     (self.joints, self.members, properties) = io.load(self.filename)
     print ">> Resolviendo la estructura por el metodo de la rigidez... "
     msa2d.msa(self.joints, self.members, properties)
     print
     t1 = time.clock()
     print ">> Guardando los resultados... "
     io.report(self.joints, self.members)
     t2 = time.clock()
     print ">> La estructura se ha resuelto en %.2f segundos: %.2f calculo y %.2f dibujo " %(t2-t0, t1-t0, t2-t1)
     webbrowser.open(os.path.join('output', 'report.html'))
     print
Пример #15
0
 def solve_msa(self):
     """ Resuelve la estructura por el metodo de la rigidez """
     print
     t0 = time.clock()
     print ">> Guardando los datos de definicion de la estructura... "
     self.save_file(self.filename)
     print ">> Leyendo los datos de definicion de la estructura... "
     (self.joints, self.members, properties) = io.load(self.filename)
     print ">> Resolviendo la estructura por el metodo de la rigidez... "
     msa2d.msa(self.joints, self.members, properties)
     print
     t1 = time.clock()
     print ">> Guardando los resultados... "
     io.report(self.joints, self.members)
     t2 = time.clock()
     print ">> La estructura se ha resuelto en %.2f segundos: %.2f calculo y %.2f dibujo " % (
         t2 - t0, t1 - t0, t2 - t1)
     webbrowser.open(os.path.join('output', 'report.html'))
     print
Пример #16
0
def load(args):
	csv_params = __get_csv_params(args)
	io.load(args.db_url, args.table, args.filename, args.append, analyze=args.analyze,
			disable_indices=args.disable_indices, csv_params=csv_params,  
			null_string=args.null_string, create_staging=args.create_staging, 
			expected_rowcount=args.expected_rowcount, direct=args.direct)
Пример #17
0
#sys.path.append( os.path.join(os.curdir,'src' ) )
import io
import expSqe
import densityOfStates
import multiphonon
import cPickle as cp
import numpy
nar = numpy.add.reduce
import Gnuplot
G = Gnuplot.Gnuplot()
Gd = Gnuplot.Data
G('set grid')
#------------------------------------------------------------------------------

#---- Setup objects -----------------------------------------------------------
e,g = io.load(dosFile)
dE = e[1] - e[0]
E = numpy.arange(floor(-maxE/dE)*dE, (ceil(maxE/dE)+1)*dE, dE)
#if e[0]==0.0: #dos contains 0 point
#    E = numpy.concatenate((-1*e[::-1],e[1:]))
#else: #dos does not contain 0 point
#    E = numpy.concatenate((numpy.append(-1*e[::-1],0.0),e))
Q = numpy.arange(minQ, maxQ, dQ)
fakeSqe = numpy.outer(Q,E)
sqe = expSqe.expSqe(Q,E,fakeSqe,fakeSqe,T,M,cutRange=cutRange)
e = numpy.arange(0.0, maxE+dE, dE)
dos = numpy.zeros(len(e))
if len(g) <= len(dos):
  dos[:len(g)] += g
else:
  dos += g[:len(dos)]
Пример #18
0
    set_xaxis_rho()
    ax.set_ylabel('$V\ [\mathrm{m^3}]$')


def decimate_plotted_lines():
    ax = plt.gca()

    for i, line in enumerate(ax.lines):
        if i % 10:
            line.set_visible(False)
            line.set_label('')


def legend_from_time(time_vector):
    text = '$t=%1.2f\ \mathrm{s}$'
    return [ text % t for t in time_vector]


if __name__ == '__main__':
    of = '/home/dwagner/work/strahl/result/strahl_result.dat'
    import io
    res = io.load(of)

    plt.figure(1); plt.clf()
    plot_overview(res)
    plt.draw()

    plt.show()

Пример #19
0
#!/usr/bin/python

import sys
import os
mypath = os.path.abspath( os.path.split(__file__)[0] )
srcpath = os.path.join( mypath, 'src' )
sys.path.append( srcpath )
sys.path.append( os.path.join(os.curdir,'src' ) )
import io

e0,d0 = io.load("dos")
D0 = d0.copy()
D0[104:124] = 0
R0 = D0.copy()

import random
for i in range(104,124):
  R0[i] += 0.02*(random.random() - 0.5)

import Gnuplot
g = Gnuplot.Gnuplot()
gd = Gnuplot.Data
g('set grid')
# g.plot(gd(e0,d0,with='l lw 5'))
# g.replot(gd(e0,D0,with='l lw 5'))
# g.replot(gd(e0,R0,with='l lw 5'))

import densityOfStates
d = densityOfStates.densityOfStates(e0,d0)
D = densityOfStates.densityOfStates(e0,D0)
R = densityOfStates.densityOfStates(e0,R0)