0

Good evening,

I've got a problem at my code; I wanna apply something (Pyneb ®) into a matrix (74 x 95). I've also defined some of my variable as np.nan, in case their value are equal or less then data error. However, when writing it to np.ravel(R), instead of writing np.nan, it simply doesn't write anything, causing an error due to modified matrix size. (Some part of) The code is as below:

fs2[fs2<=3*errorfs2] = np.nan
fs1[fs1<=3*errorfs1] = np.nan
R = fs2/fs1
dens = []
for p in np.ravel(R): 
#    print(p)
    d = diags.getCrossTemDen('[NeIII] 3343/3930+','[SII] 6731/6716',1E-03,p)
    dens.append(d)

So, what I wanna do is: when fs1 and fs2 are defined as np.nan, the loop writes np.nan into the np.ravel(R) as well.

Thank you so much!

  • 2
    I don't understand. Please show the reproducible code including unexpected and expected results. – Julien Jun 10 '16 at 01:46
  • It's running right now; when it stops, I'll post the error message here. – Daniel Schneider Grün Jun 10 '16 at 01:50
  • I'm not sure about reproducing the code here, since it has ~250 lines... – Daniel Schneider Grün Jun 10 '16 at 01:54
  • 2
    just create a minimal example [mcve] please. (basically remove getCrossTemDen from your example and show us exactly what is wrong). If getCrossTemDen is the problem then you need to narrow down where it goes wrong...) – Julien Jun 10 '16 at 01:56
  • But if I remove *getCrossTemDen* the code doesn't make sense; it's part of *Pyneb* routine, which I'm trying to work with. My doubt is: how to write *np.nan* "numbers" into the *np.ravel*, instead of leaving it's place blank - and making the *np.ravel* smaller - ? – Daniel Schneider Grün Jun 10 '16 at 02:05
  • That's why it prints the error: *ValueError: total size of new array must be unchanged*. – Daniel Schneider Grün Jun 10 '16 at 02:07
  • 2
    Well I can't help you without an MCVE... Again if the error comes from your function we need to see the bit in it that causes the error. – Julien Jun 10 '16 at 02:12

0 Answers0