arfc / d3ploy

A collection of Cyclus manager archetypes for demand driven deployment
BSD 3-Clause "New" or "Revised" License
4 stars 11 forks source link

D3ploy is not running FFT properly on numpy 1.16.4 #263

Closed FlanFlanagan closed 5 years ago

FlanFlanagan commented 5 years ago
robert@robert-VirtualBox:~/d3ploy/input$ cyclus linear_pow_demand.xml :
.CL:CC CC _Q _Q _Q_Q _Q _Q Q
CC;CCCCCCCC:C; /
) /)//\) /) /) /_)
CCCCCCCCCCCCCl __O
/O___O /O_OO /O__O /O__O /O____O /O__ CCCCCCf iCCCLCC ///////////////////////////////////////////////// iCCCt ;;;;;. CCCC
CCCC ;;;;;;;;;. CClL. c
CCCC ,;; ;;: CCCC ; : CCCCi
CCC ;; ;; CC ;;: CCC`C; lCCC ;; CCCC ;;;: :CC .;;. C; ; : ; :;; CCCC ;. CCCC ;;;, CC ; ; Ci ; : ; : ; iCC :; CC ;;;, ;C ; CC ; : ; . CCCi ;; CCC ;;;. .C ; tf ; : ; ;. CCC ;; CCC ;;;;;;; fC : lC ; : ; ;: iCf ;; CC :;;: tC ; CC ; : ; ; fCCC :; LCCf ;;;: LC :. ,: C ; ; ; ; ; CCCC ;; CCCC ;;;: CCi;;` CC. ;;;; :;.;. ; ,;
CCl ;; CC ;;;; CCC CCL
tCCC ;; ;; CCCL ;;; tCCCCC.
CCCC ;; :;; CCCCf ; ,L
lCCC ;;;;;; CCCL
CCCCCC :;; fCCCCC
. CCCC CCCC .
.CCCCCCCCCCCCCi
iCCCCCLCf
. C. ,

/home/robert/.local/lib/python3.6/site-packages/numpy/lib/polynomial.py:627: RuntimeWarning: invalid value encountered in true_divide lhs /= scale On entry to DLASCL parameter number 4 had an illegal value**

This only occurs for FFT, and that doesn't happen for older version of numpy.

FlanFlanagan commented 5 years ago

@gwenchee can you put your version in?

This version that is causing the error is 1.16.4.

gwenchee commented 5 years ago

My numpy version is 1.14.6 and fft works for me

gwenchee commented 5 years ago

@sonatav2 try running the input file cyclus linear_pow_demand.xml and tell us what your output is

sonatav2 commented 5 years ago

numpy 1.16.4 runs cyclus linear_pow_demand.xml successfully for me

FlanFlanagan commented 5 years ago

linear_pow_demand.xml is poly in the master branch. you need to set the calc_method to FFT in order to test this.

sonatav2 commented 5 years ago

After changing calc_method to FFT, this is the output:

sonata@UbuntuVB:~/fuelcycle/d3ploy/input$ cyclus linear_pow_demand.xml
              :                                                               
          .CL:CC CC             _Q     _Q  _Q_Q    _Q    _Q              _Q   
        CC;CCCCCCCC:C;         /_\)   /_\)/_/\\)  /_\)  /_\)            /_\)  
        CCCCCCCCCCCCCl       __O|/O___O|/O_OO|/O__O|/O__O|/O____________O|/O__
     CCCCCCf     iCCCLCC     /////////////////////////////////////////////////
     iCCCt  ;;;;;.  CCCC                                                      
    CCCC  ;;;;;;;;;. CClL.                          c                         
   CCCC ,;;       ;;: CCCC  ;                   : CCCCi                       
    CCC ;;         ;;  CC   ;;:                CCC`   `C;                     
  lCCC ;;              CCCC  ;;;:             :CC .;;. C;   ;    :   ;  :;;   
  CCCC ;.              CCCC    ;;;,           CC ;    ; Ci  ;    :   ;  :  ;  
   iCC :;               CC       ;;;,        ;C ;       CC  ;    :   ; .      
  CCCi ;;               CCC        ;;;.      .C ;       tf  ;    :   ;  ;.    
  CCC  ;;               CCC          ;;;;;;; fC :       lC  ;    :   ;    ;:  
   iCf ;;               CC         :;;:      tC ;       CC  ;    :   ;     ;  
  fCCC :;              LCCf      ;;;:         LC :.  ,: C   ;    ;   ; ;   ;  
  CCCC  ;;             CCCC    ;;;:           CCi `;;` CC.  ;;;; :;.;.  ; ,;  
    CCl ;;             CC    ;;;;              CCC    CCL                     
   tCCC  ;;        ;; CCCL  ;;;                  tCCCCC.                      
    CCCC  ;;     :;; CCCCf  ;                     ,L                          
     lCCC   ;;;;;;  CCCL                                                      
     CCCCCC  :;;  fCCCCC                                                      
      . CCCC     CCCC .                                                       
       .CCCCCCCCCCCCCi                                                        
          iCCCCCLCf                                                           
           .  C. ,                                                            
              :                                                               

Status: Cyclus run successful!
Output location: cyclus.sqlite
Simulation ID: 139b3000-79ff-4e96-ba49-04ca5dd4a71e
Exception ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 1289, in _shutdown
    assert tlock.locked()
SystemError: <built-in method locked of _thread.lock object at 0x7f6b9aa49d78> returned a result with an error set
sonatav2 commented 5 years ago

Note: That output was produced using FFT as the calc_method. We should probably add an error message for that case, assuming it wasn't recognized as a legitimate calc_method but still returned "Cyclus run successful!"? Changing to fft produced the same error as @FlanFlanagan.

sonata@UbuntuVB:~/fuelcycle/d3ploy/input$ cyclus linear_pow_demand.xml
              :                                                               
          .CL:CC CC             _Q     _Q  _Q_Q    _Q    _Q              _Q   
        CC;CCCCCCCC:C;         /_\)   /_\)/_/\\)  /_\)  /_\)            /_\)  
        CCCCCCCCCCCCCl       __O|/O___O|/O_OO|/O__O|/O__O|/O____________O|/O__
     CCCCCCf     iCCCLCC     /////////////////////////////////////////////////
     iCCCt  ;;;;;.  CCCC                                                      
    CCCC  ;;;;;;;;;. CClL.                          c                         
   CCCC ,;;       ;;: CCCC  ;                   : CCCCi                       
    CCC ;;         ;;  CC   ;;:                CCC`   `C;                     
  lCCC ;;              CCCC  ;;;:             :CC .;;. C;   ;    :   ;  :;;   
  CCCC ;.              CCCC    ;;;,           CC ;    ; Ci  ;    :   ;  :  ;  
   iCC :;               CC       ;;;,        ;C ;       CC  ;    :   ; .      
  CCCi ;;               CCC        ;;;.      .C ;       tf  ;    :   ;  ;.    
  CCC  ;;               CCC          ;;;;;;; fC :       lC  ;    :   ;    ;:  
   iCf ;;               CC         :;;:      tC ;       CC  ;    :   ;     ;  
  fCCC :;              LCCf      ;;;:         LC :.  ,: C   ;    ;   ; ;   ;  
  CCCC  ;;             CCCC    ;;;:           CCi `;;` CC.  ;;;; :;.;.  ; ,;  
    CCl ;;             CC    ;;;;              CCC    CCL                     
   tCCC  ;;        ;; CCCL  ;;;                  tCCCCC.                      
    CCCC  ;;     :;; CCCCf  ;                     ,L                          
     lCCC   ;;;;;;  CCCL                                                      
     CCCCCC  :;;  fCCCCC                                                      
      . CCCC     CCCC .                                                       
       .CCCCCCCCCCCCCi                                                        
          iCCCCCLCf                                                           
           .  C. ,                                                            
              :                                                               
/home/sonata/.local/lib/python3.6/site-packages/numpy/lib/polynomial.py:627: RuntimeWarning: invalid value encountered in true_divide
  lhs /= scale
 ** On entry to DLASCL parameter number  4 had an illegal value
sonatav2 commented 5 years ago

I tried downgrading my numpy to 1.14.6 and reinstalling everything (scipy version 1.2.0, hoping that would bypass the module import errors) - but that brought back all the module import errors. Might just bypass fft as a calc_method for now.

sonatav2 commented 5 years ago

An update - this is almost definitely an issue with the the numpy polyfit function as it tries to fit the timeseries data within the fft function. Line 98 in d3ploy/DO_solvers.py (np.polyfit(t, timeseries, degree)). The unhelpful "DLASCL parameter number 4" error message is a known issue with numpy that occurs when the inputs are invalid for a polynomial fit in some way (https://github.com/numpy/numpy/issues/5528).

FlanFlanagan commented 5 years ago

fixed with #267