Re: [Python] Problema con distutils

2019-10-22 Per discussione Alberto Girardi
Ho riprovato mettendo fra virgolette i nomi degli script:

  C:\...>python "setup.py" install

da lo stesso errore di
  C:\...>Python setup.py install

Il giorno mar 22 ott 2019 alle ore 17:00 Alberto Girardi <
alberto.gir...@gmail.com> ha scritto:

> Ecco il file setup.py
>
> from distutils.core import setup
>
>
> setup(
> name = 'PyNEURONE',
> version = '1.3.1',
> description = 'Leggi il file .txt nella cartella',
> long_description = open('FAQ_PyNeur.txt', 'r').read(),
> py_modules = ['Ag_Neuron'],
> author = 'Alberto Girardi',
> author_email = 'alberto.gir...@gmail.com',
> keywords = 'python generators distutils',
> scripts = 'PyNEURONE-1.3.1.py',
> platforms = 'all',
> classifiers = ['Intended Audience::Education'
> ]
>
> )
>
>
> Ecco anche il file che contiene la definizione delle classi. E' abbastanza
> grande, spero di non intasare troppo la mail:
>
> import math
>
> class Neurone:
>
> def __init__(self):
> self.pesi = [1, 1]
> self.learning_rate = 0.4999
> self.delta_learningrate = 0.0018
> self.errore_tot = 0
>
> def detPesi(self, ninputs):
> pesi = [1 for i in range( ninputs)]
>
> def activationFunction(self, pa):
> #soglia
>return 1/(1 + math.exp(-pa))
> #if pa> 0.0:
># return 1.0
># else:
>  #   return 0.0
>
> def output (self, inputs):
> pa = 0
> for i in range(len(inputs)):
> pa += inputs[i] * self.pesi[i]
>
> return self.activationFunction(pa)
>
> def learn(self, x, target ):
> out = self.output(x)
> errore = target - out
>
> for i, w in enumerate(self.pesi):
>
> self.pesi[i] += self.learning_rate * errore * x[i]
>
> print('  target : ', target, ' '*(15-len(str(target))),'
> out:',out,' '*(22-len(str(out))),'  errore:',errore)
>
> class Progetto():
>
> def __init__(self, neurone, nome=''):
> self.neuron = neurone
> self.nome = nome
> self.file_in = ''
> self.n_dir = ''
> self.x_data = []
> self.y_data = []
> self.prog_loc = ''"
>
> def creaProgetto(self, name, f_in):
> import os
> self.nome = name
>
> try:
>
> f_log = open('log_p.txt', 'r' )
> self.prog_loc = f_log.readline()
> f_log.close()
>
> except FileNotFoundError:
>
>
> self.prog_loc = input('\nLa cartella progetti_ML non è
> presente, in che path si vuole inserire la cartella (se su Windosw usare la
> \\ ):')
> f_log = open('log_p.txt', 'x' )
> f_log.write(self.prog_loc)
> f_log.close()
>
> os.mkdir('{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc, self.nome))
>
>
>
> self.n_dir= '{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc,
> self.nome)
>
> try:
>
> f_lp =
> open('{0}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc), 'a')
>
>
> f_lp.write(self.nome+'\n')
> f_lp.close()
>
>
># except:
> #f_lp.close()
>   #  print('Problema con il file')
> except:
> pass
>
> import time
>
> try:
> with
> open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'),
> 'a') as f_s:
> f_s.write('Progetto {0} creato il {1} alle
> {2}\n'.format(self.nome, time.strftime('%d/%m/%Y'),
> time.strftime('%H:%M:%S')))
>
> except FileNotFoundError:
> f_s =
> open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'), 'w')
> f_s.write('Progetto {0} creato il {1}\n'.format(self.nome,
> time.strftime('%d/%m/%Y alle %H:%M:%S')))
> f_s.close()
>
>
>
> self.file_in = self.n_dir+'\\f_inputs.csv'
>
> try:
>
> os.mkdir(self.n_dir)
> print('\nCartella creata')
>
> except :
> pass
>
>
> with  open(f_in,'r') as f_inp:
> with open(self.file_in, 'w') as f_inpc:
>
> f_inpc.write(f_inp.read())
>
>
> with open('{}\\storico.txt'.format(self.n_dir), 'w') as f_st:
> f_st.write('Progetto {0} creato il {1} alle {2}, nel percorso
> "{3}".\n'.format(self.nome, time.strftime('%d/%m/%Y'),
> time.strftime('%H:%M:%S'), self.n_dir))
>
> print('Progetto {0} creato il {1} alle {2}, nel percorso
> "{3}"\nProggetto aggiunto alla lista dei progetti.'.format(self.nome,
> time.strftime('%d/%m/%Y'), time.strftime('%H:%M:%S'), self.n_dir))
> print('File inputs copiato nella cartella del progetto')
> print('Progetto aggiunto allo storico')
>
>
>
>
>
> def mostraProgetti(self):
> with open('log_p.txt', 'r' ) as f_log:
>
> self.prog_loc = f_log.readline()
>
> f =
> open('{}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc))
>
> with f:
>  

[Python] Scomposizione di polinomi

2019-10-22 Per discussione Gianluca

Buongiorno a tutti,

è da un po' di tempo che sto lavorando ad un'implementazione in Python 
per monomi e polinomi e, finalmente, son riuscito a finire tutti i 
metodi fondamentali.


L'unica cosa che mi manca sono le scomposizioni di polinomi, quindi ho 
iniziato a ragionare su come implementare ogni "metodo" di scomposizione 
(prodotti notevoli, raccoglimenti ecc.), ma mi sono subito bloccato al 
raccoglimento parziale (`XA + XB + YA + YA = X(A + B) + Y(A + B) = (X + 
Y)(A + B)`. Come fareste voi?


Se volete dare un'occhiata al codice (o alle docs) per capire meglio, 
potete trovarlo su github (https://github.com/gianluparri03/ruffini).



Gianluca

___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] Problema con distutils

2019-10-22 Per discussione Alberto Girardi
Ecco il file setup.py

from distutils.core import setup


setup(
name = 'PyNEURONE',
version = '1.3.1',
description = 'Leggi il file .txt nella cartella',
long_description = open('FAQ_PyNeur.txt', 'r').read(),
py_modules = ['Ag_Neuron'],
author = 'Alberto Girardi',
author_email = 'alberto.gir...@gmail.com',
keywords = 'python generators distutils',
scripts = 'PyNEURONE-1.3.1.py',
platforms = 'all',
classifiers = ['Intended Audience::Education'
]

)


Ecco anche il file che contiene la definizione delle classi. E' abbastanza
grande, spero di non intasare troppo la mail:

import math

class Neurone:

def __init__(self):
self.pesi = [1, 1]
self.learning_rate = 0.4999
self.delta_learningrate = 0.0018
self.errore_tot = 0

def detPesi(self, ninputs):
pesi = [1 for i in range( ninputs)]

def activationFunction(self, pa):
#soglia
   return 1/(1 + math.exp(-pa))
#if pa> 0.0:
   # return 1.0
   # else:
 #   return 0.0

def output (self, inputs):
pa = 0
for i in range(len(inputs)):
pa += inputs[i] * self.pesi[i]

return self.activationFunction(pa)

def learn(self, x, target ):
out = self.output(x)
errore = target - out

for i, w in enumerate(self.pesi):

self.pesi[i] += self.learning_rate * errore * x[i]

print('  target : ', target, ' '*(15-len(str(target))),'
out:',out,' '*(22-len(str(out))),'  errore:',errore)

class Progetto():

def __init__(self, neurone, nome=''):
self.neuron = neurone
self.nome = nome
self.file_in = ''
self.n_dir = ''
self.x_data = []
self.y_data = []
self.prog_loc = ''"

def creaProgetto(self, name, f_in):
import os
self.nome = name

try:

f_log = open('log_p.txt', 'r' )
self.prog_loc = f_log.readline()
f_log.close()

except FileNotFoundError:


self.prog_loc = input('\nLa cartella progetti_ML non è
presente, in che path si vuole inserire la cartella (se su Windosw usare la
\\ ):')
f_log = open('log_p.txt', 'x' )
f_log.write(self.prog_loc)
f_log.close()

os.mkdir('{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc, self.nome))



self.n_dir= '{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc,
self.nome)

try:

f_lp =
open('{0}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc), 'a')


f_lp.write(self.nome+'\n')
f_lp.close()


   # except:
#f_lp.close()
  #  print('Problema con il file')
except:
pass

import time

try:
with
open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'),
'a') as f_s:
f_s.write('Progetto {0} creato il {1} alle
{2}\n'.format(self.nome, time.strftime('%d/%m/%Y'),
time.strftime('%H:%M:%S')))

except FileNotFoundError:
f_s =
open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'), 'w')
f_s.write('Progetto {0} creato il {1}\n'.format(self.nome,
time.strftime('%d/%m/%Y alle %H:%M:%S')))
f_s.close()



self.file_in = self.n_dir+'\\f_inputs.csv'

try:

os.mkdir(self.n_dir)
print('\nCartella creata')

except :
pass


with  open(f_in,'r') as f_inp:
with open(self.file_in, 'w') as f_inpc:

f_inpc.write(f_inp.read())


with open('{}\\storico.txt'.format(self.n_dir), 'w') as f_st:
f_st.write('Progetto {0} creato il {1} alle {2}, nel percorso
"{3}".\n'.format(self.nome, time.strftime('%d/%m/%Y'),
time.strftime('%H:%M:%S'), self.n_dir))

print('Progetto {0} creato il {1} alle {2}, nel percorso
"{3}"\nProggetto aggiunto alla lista dei progetti.'.format(self.nome,
time.strftime('%d/%m/%Y'), time.strftime('%H:%M:%S'), self.n_dir))
print('File inputs copiato nella cartella del progetto')
print('Progetto aggiunto allo storico')





def mostraProgetti(self):
with open('log_p.txt', 'r' ) as f_log:

self.prog_loc = f_log.readline()

f =
open('{}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc))

with f:
print('\n\nScegliere uno fra i seguenti progetti:\n\n',f.read())


def getProgetto(self):
self.nome = input('\nChe progetto si vuole caricare: ')

with open('log_p.txt', 'r' ) as f_log:

self.prog_loc = f_log.readline()


self.n_dir = '{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc,
self.nome)

with
 open('{}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc), 'r') as
f_lp:

if self.nome in f_lp.read():
print('Progetto esistente e caricato 

Re: [Python] Libreria wxPython (Andrea Biolchini)

2019-10-22 Per discussione Andrea D'Amore
On Mon, 21 Oct 2019 at 17:59, Giovanni Bozza
 wrote:
> Volevo solo fare un piccolo suggerimento per il problema in oggetto.

Qual è questo problema? In oggetto leggo solo "Libreria wxPython".

> Propongo di utilizzare la libreria / framework chiamata "appJar" reperibile 
> all'URL http://appjar.info/

Mmm… ha "jar" nel nome, sono già sospettoso.

Se dovessi scrivere GUI io userei più Toga di BeeWare [1] dato che RKM
è abbastanza attivo nella scena Python e questo mi sembra proiettare
un po' meglio il progetto nel futuro.


[1]: https://beeware.org

-- 
Andrea
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python