afeinstein20 / stella

For characterizing flares with convolutional neural networks
https://adina.feinste.in/stella
MIT License
26 stars 18 forks source link

cnn.predict error #16

Closed pjstanley1 closed 3 years ago

pjstanley1 commented 3 years ago

Hello Adına,

I've encountered an error when trying to run cnn.predict. The issue appears to arise from the dtype of the time array not being a format np.isnan likes. Any suggestions on how to fix this issue would be much appreciated! The error is as follows:


TypeError Traceback (most recent call last)

in ----> 1 cnn.predict(modelname=MODELS[0], 2 times=lc.time, 3 fluxes=lc.flux, 4 errs=lc.flux_err) 5 single_pred = cnn.predictions[0] ~/anaconda3/envs/stella/lib/python3.8/site-packages/stella/neural_network.py in predict(self, modelname, times, fluxes, errs, multi_models, injected) 541 err = errs[j] + 0.0 542 --> 543 q = ( (np.isnan(time) == False) & (np.isnan(lc) == False)) 544 time, lc, err = time[q], lc[q], err[q] 545 TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' Thanks, Patrick
github-actions[bot] commented 3 years ago

Hi there! This is a test of github actions.

pjstanley1 commented 3 years ago

Hello, I managed to fix the error by changing line 539 of neural_network.py from: time=times[j] + 0.0 to time=times[j].bkjd +0.0