Пример #1
0
 def execute():
     try:
         scilab.getd(os.getcwd()+"/")
         scilab.colourtransform(self.fnm,rgb,outpath)
         load_images()
     except Exception as e:
         res=Popup(title="Error",content=Label(text="" + str(e)),size_hint=(None, None), size=(600, 400))
         res.open()
         mainimg.source = "noimg.jpg"
Пример #2
0
 def execute():
     try:
         scilab.getd(os.getcwd() + "/")
         #call scilab enhancement functions
         scilab.enhancement(self.fnm, rgb, self.tp1, var1, var2,
                            outpath)
         load_images()
     except Exception as e:
         mainimg.source = self.fnm
         res = Popup(title="Error",
                     content=Label(text="" + str(e)),
                     size_hint=(None, None),
                     size=(600, 400))
         res.open()
Пример #3
0
 def execute():
     try:
         scilab.getd(os.getcwd() + "/")
         #call scilab filternew function
         scilab.filternew(self.fnm, rgb, self.tp1, ws1, ws2, sigma,
                          outpath)
         #call load images function
         load_images()
     except Exception as e:
         mainimg.source = self.fnm
         res = Popup(title="Error",
                     content=Label(text="" + str(e)),
                     size_hint=(None, None),
                     size=(600, 400))
         res.open()
Пример #4
0
 def execute():
     try:
         scilab.getd(os.getcwd() + "/")
         #call scilab test function
         scilab.test(self.fnm, bandvalue.text, self.egtype,
                     slider.value, self.direction, outpath)
         load_images()
     except Exception as e:
         res = Popup(title="Error",
                     content=Label(text="" + str(e)),
                     size_hint=(None, None),
                     size=(600, 400))
         mainimg.source = self.fnm
         mainimg.reload()
         res.open()
Пример #5
0
 def execute():
     try:
         scilab.getd(os.getcwd() + "/")
         #call imgdisplay functions
         scilab.imgdisplay(self.fnm, rgb, subrow, subcol, 'win4pix.txt',
                           outpath)
         #call load functions
         load_images()
     except Exception as e:
         mainimg.source = self.fnm
         imgname.text = str(self.fnm)
         res = Popup(title="Error",
                     content=Label(text="" + str(e)),
                     size_hint=(None, None),
                     size=(600, 400))
         res.open()
Пример #6
0
 def execute():
     try:
         scilab.getd(os.getcwd() + "/")
         #call scilab fftfilter function
         scilab.fftfilter(self.fnm, rgb, self.ptype, cutoff, order,
                          self.ftype, outpath)
         #call load_images function
         load_images()
     except Exception as e:
         mainimg.source = self.fnm
         mainimg.reload()
         res = Popup(title="Error",
                     content=Label(text="" + str(e)),
                     size_hint=(None, None),
                     size=(600, 400))
         res.open()
Пример #7
0
import os
from scilab2py import scilab
import numpy as np
from Tkinter import Tk
from tkFileDialog import askopenfilename, askdirectory
Tk().withdraw()
if (input("chose all file dir \n1.use current dirrector 2.other:") == 1):
    scilab.getd(str(os.getcwd()))
else:
    scilab.getd(str(askdirectory()))
#out=scilab.test(5,6)
#print("this is in test "+ str(out))
#exec('~/usr/share/scilab/contrib/sivp/loader.sce')
#fnm=str(askopenfilename(filetypes = [("Image Files", ("*.jpg", "*.gif")),("JPEG",'*.jpg'),("GIF",'*.gif')]))
fnm = str(askopenfilename())
rgb = np.matrix("'" + str(int(input("Enter R value(1-3): "))) + "," +
                str(int(input("Enter G value(1-3): "))) + "," +
                str(int(input("Enter B value(1-3): "))) + "'")

outpath = ""
if (input("chose all file dir \n1.use current dirrector 2.other") == 1):
    outpath = os.getcwd()
else:
    outpath = askdirectory() + '/'

scilab.colourtransform(fnm, rgb, outpath)
Пример #8
0
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.slider import Slider
from kivy.uix.button import Button
from kivy.uix.image import Image
from scilab2py import scilab
scilab.getd('~/Documents/foss/')
import os
import numpy as np


class CalcApp(App):
    def input(self):
        try:
            label.text = (eval(label.text))
        except:
            label.text = 'syn error'


CalcApp().run()
def main():

    # adicionando o diretório corrente tanto para o scilab quanto para o octave
    sci.getd(os.getcwd())
    oc.addpath(os.getcwd())

    # Aqui nós pedimos para que os prints dos programas do scilab e do octave sejam exibidos no terminal do python
    #   oc.logger.setLevel(logging.DEBUG)
    oc.logger.setLevel(logging.INFO)
    #   sci.logger.setLevel(logging.INFO)

    # setando os valores de I, J, J_sup, Ai, Af, Bi, Bf
    setDyIni_16733()
    setHiperfinaDy161_0_16733()

    #   setDyIni_16693()
    #   setHiperfinaDy161_0_16693()

    #   print "I = " + str(I) + ";"
    #   print "J = " + str(J) + ";"
    #   print "J_sup = " + str(J_sup) + ";"
    #   print "Ai = " + str(Ai) + ";"
    #   print "Af = " + str(Af) + ";"
    #   print "Bi = " + str(Bi) + ";"
    #   print "Bf = " + str(Bf) + ";"

    # h161 é a tabela hiperfina do isotopo 161
    h161 = sci.callHiperfina(I, J, J_sup, Ai, Af, Bi, Bf)

    # Essa linha desloca o zero pra esquerda, mas a eq. de Casimir já coloca o zero no centro de massa
    # Então não precisa dessa linha.
    #   h161[:, 0] = h161[:,0] - min(h161[:,0])

    plot_Casimir(h161, "Dy_h161_16733")
    #   plot_Casimir(h161, "Dy_h161_16693")
    setHiperfinaDy163_0_16733()
    #   setHiperfinaDy163_0_16693()
    h163 = sci.callHiperfina(I, J, J_sup, Ai, Af, Bi, Bf)

    # Essa linha desloca o zero pra esquerda, mas a eq. de Casimir já coloca o zero no centro de massa
    # Então não precisa dessa linha.
    #   h163[:, 0] = h163[:,0] - min(h163[:,0])

    plot_Casimir(h163, "Dy_h163_16733")
    #   plot_Casimir(h163, "Dy_h163_16693")

    [
        nu, nu_cm, num_onda, num_onda_cm, perfil, s, nome_fig, M, M_from, M_to,
        lamb, elem, lim_perfil
    ] = oc.main(h161, h163)

    # debug retorno do oct2py:
    #   print "##########################"
    #   print "num_onda type: " + str(type(num_onda))
    #   print "num_onda_cm type: " + str(type(num_onda_cm))
    #   print "s type: " + str(type(s))
    #   print np.where(s[0,:] == s[0,:].max())
    #   print num_onda[0][np.where(s[0,:] == s[0,:].max())]
    #   print perfil.shape
    #   print perfil.size
    #   print perfil[0,1]
    #   print "##########################"

    plot(nu, nu_cm, num_onda, num_onda_cm, perfil, s, nome_fig, M, M_from,
         M_to, lamb, elem, lim_perfil)

    mat = np.vstack((nu, num_onda, perfil, s))

    #   print mat.shape
    #   print len(nu_cm)
    #   print len(mat)
    # Para salvar as matrizes para arquivo terei de usar esse comando a seguir.
    # documentação em https://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html
    np.savetxt(filename,
               np.transpose(mat),
               fmt='%.18e',
               delimiter=',',
               newline='\n',
               header='',
               footer='',
               comments='# ')