Python y JMP 18Hola,
Estoy intentando usar un fragmento de código en JMP 18, pero no estoy seguro de entender cómo funciona. Instalo los paquetes de Pythonn desde el principio, luego envío mis variables a Python y ejecuto el código. Sin embargo, siempre recibo uno de los siguientes errores: o no detecta numpy, aunque esté instalado, o ya no detecta la variable que acabo de enviar.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
lstMeasures = Column( dt, "height" ) << Get As Matrix();
Python Install Packages( "numpy pandas scipy" );
Python Send( lstMeasures );
Python Submit(
"
import numpy as np
from scipy.stats import kstest, norm, weibull_min, rayleigh
data = np.array(lstMeasures)
# Fit des lois
mu, sigma = norm.fit(data)
ks_norm = kstest(data, 'norm', args=(mu, sigma))
c, loc, scale = weibull_min.fit(data)
ks_weibull = kstest(data, 'weibull_min', args=(c, loc, scale))
loc_r, scale_r = rayleigh.fit(data)
ks_rayleigh = kstest(data, 'rayleigh', args=(loc_r, scale_r))
"
);
ks_norm = Python Get( ks_norm );
ks_weibull = Python Get( ks_weibull );
ks_rayleigh = Python Get( ks_rayleigh );


Automatización y scriptingRe: Python y JMP 18¿Estás ejecutando exactamente ese código en el editor de scripts de JMP (JSL)? No veo ningún problema con el script y me funciona bien.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
lstMeasures = Column(dt, "height") << Get As Matrix();
Python Install Packages("numpy pandas scipy");
Python Send(lstMeasures);
Python Submit("
import numpy as np
from scipy.stats import kstest, norm, weibull_min, rayleigh
data = np.array(lstMeasures)
mu, sigma = norm.fit(data)
ks_norm = kstest(data, 'norm', args=(mu, sigma))
c, loc, scale = weibull_min.fit(data)
ks_weibull = kstest(data, 'weibull_min', args=(c, loc, scale))
loc_r, scale_r = rayleigh.fit(data)
ks_rayleigh = kstest(data, 'rayleigh', args=(loc_r, scale_r))
");
ks_norm = Python Get(ks_norm);
ks_weibull = Python Get(ks_weibull);
ks_rayleigh = Python Get(ks_rayleigh);
show(ks_norm, ks_weibull, ks_rayleigh);
@Paul_Nelson
Re: Python y JMP 18Hola, estaba usando JMP 18.0.0 pero reinicié JMP y ahora no tuve más problemas...
Re: Python y JMP 18A veces, especialmente la primera vez que se ejecuta JMP, es posible que tenga que reiniciarlo para que reconozca los paquetes de Python recién instalados. Numpy es particularmente quisquilloso. Además, el mecanismo de gestión de paquetes de Python no busca de nuevo un paquete que no se pudo importar. Sabe que falló, así que ¿para qué intentarlo de nuevo? Puede forzar la recarga de un paquete usando importlib y reload.