quick question here.
When I run my Python script (Py 3.7.2) I got this code:
Process finished with exit code -1
In general I would expect exit code 0
, but why there is -1
?
Kind regards
UPDATE! I've added some code to give you an insight into my problem.
import numpy as np
import matplotlib.pyplot as plt
from lmfit import Model
def read_datafile(file_name):
data = np.loadtxt(file_name, delimiter=' ')
return data
def decomposition2(x, amp, cen, sig, e):
return float(amp) * (1 + float(e) * (x - float(cen))) / (pow((x - float(cen)), 2) + pow((float(sig) / 2), 2))
for r in range(20, 91, 1):
dataread = np.loadtxt("S:/Data/Model4/Mod{}.csv".format(r), delimiter=' ',
unpack=True)
x = dataread[0,]
y = dataread[1,]
peak1b = Model(decomposition2, prefix='p1b_')
peak2b = Model(decomposition2, prefix='p2b_')
peak3b = Model(decomposition2, prefix='p3b_')
peak4b = Model(decomposition2, prefix='p4b_')
model2 = peak1b + peak2b + peak3b + peak4b
params2 = model2.make_params(p1b_amp=1, p1b_cen=7.708, p1b_sig=4.43, p1b_e=0,
p2b_amp=1, p2b_cen=13.880, p2b_sig=5.26, p2b_e=0,
p3b_amp=1, p3b_cen=20.037, p3b_sig=5.78, p3b_e=0,
p4b_amp=1, p4b_cen=26.237, p4b_sig=6.16, p4b_e=0)
result2 = model2.fit(y, params2, x=x, fit_kws={'maxfev':20000000})
final2 = result2.best_fit
Your process is being killed by signal 1 (HUP).
$ python3 -c 'import subprocess; print(subprocess.run(["cat"]).returncode)' & sleep 1 && pkill -HUP cat && fg
[1] 27339
[1]+ Stopped python3 -c 'import subprocess; print(subprocess.run(["cat"]).returncode)'
python3 -c 'import subprocess; print(subprocess.run(["cat"]).returncode)'
-1
In Python, processes killed by signals are given a negative exit status: "A negative value -N indicates that the child was terminated by signal N (POSIX only)." https://docs.python.org/3.6/library/subprocess.html
HUP has integer value 1, so -N is -1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With