Skip to Content.
Sympa Menu

opal - Re: [Opal] issue reading json file from sampler w/ pyOPALTools

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

Re: [Opal] issue reading json file from sampler w/ pyOPALTools


Chronological Thread  
  • From: "Adelmann Andreas (PSI)" <andreas.adelmann AT psi.ch>
  • To: Philippe Piot <philippe.piot AT gmail.com>
  • Cc: "opal AT lists.psi.ch" <opal AT lists.psi.ch>
  • Subject: Re: [Opal] issue reading json file from sampler w/ pyOPALTools
  • Date: Wed, 12 May 2021 21:49:40 +0000
  • Accept-language: en-US, de-CH
  • Authentication-results: localhost; iprev=pass (psi-seppmail1.ethz.ch) smtp.remote-ip=129.132.93.141; spf=pass smtp.mailfrom=psi.ch; dmarc=skipped

Hello Philippe here what I am using:


fn = 'ML_1samples_0.json'
from db import mldb

database = mldb.mldb()
database.buildFromSampler(fn, '.', ‘')

database.printOverview()

xDim        = 9 -> ['currFoc', 'currMat', 'gunE', 'gunPhi', 'lin1dx', 'lin1dy', 'lin1E', 'lin1Phi', 'lsrSzR']
yDim        = 40 -> ['OBJ1', 'OBJ10', 'OBJ11', 'OBJ12', 'OBJ13', 'OBJ14', 'OBJ15', 'OBJ16', 'OBJ17', 'OBJ18', 'OBJ19', 'OBJ2', 'OBJ20', 'OBJ21', 'OBJ22', 'OBJ23', 'OBJ24', 'OBJ25', 'OBJ26', 'OBJ27', 'OBJ28', 'OBJ29', 'OBJ3', 'OBJ30', 'OBJ31', 'OBJ32', 'OBJ33', 'OBJ34', 'OBJ35', 'OBJ36', 'OBJ37', 'OBJ38', 'OBJ39', 'OBJ4', 'OBJ40', 'OBJ5', 'OBJ6', 'OBJ7', 'OBJ8', 'OBJ9']
generations = 1
Data points  = 3
Show first dataset from generation 0: y = f(x)
[ 1.00000000e+00  6.49540192e+00  4.41186133e-03  4.37709275e-03
  1.02630747e-01 -2.96003700e-04  1.82691492e-04 -1.89388102e-01
  5.80984261e-04 -5.48786309e-04  9.99997650e-01  1.00000000e+05
  1.50399348e-02 -1.73348200e-02  1.69817585e+01  9.83824236e-02
  9.43157414e-02 -1.03602130e-03  5.38600570e-01  5.43107428e-01
  9.99294466e-01 -8.11953408e-04 -1.00000000e-09  2.14912049e-02
 -3.34559371e-04 -3.32177473e-02 -4.64941397e-04 -5.19969271e-04
 -2.36220102e-05  4.03234326e-01 -3.87819864e-01 -2.20889625e+00
  3.31156890e+00  7.05705662e+00  1.00000000e-02  2.08449101e-02
  2.06720269e-02  4.20700483e-01  2.51184933e-01  2.52156948e-01] = f([ 5.26546660e+02  4.27806279e+02  6.25643560e+01 -2.18236390e+01
  3.22615173e-03 -3.24745351e-03  2.36185546e+01 -1.27112301e+01
  8.94234895e-04])

to me this works well. 

Here is a sparse doc on the mldb: http://amas.web.psi.ch/docs/pyOPALTools/db.html

I hope this helps.

Cheers A
------
Dr. sc. math. Andreas (Andy) Adelmann
Head a.i. Labor for Scientific Computing and Modelling 
Paul Scherrer Institut OHSA/ CH-5232 Villigen PSI
Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
Zoom ID: 470-582-4086 Password: AdA
Zoom Link: https://ethz.zoom.us/j/4705824086?pwd=dFcvT1pMMGY0bHg0dTNncUNZZTJkZz09

-------------------------------------------------------
Friday: ETH HPK G 28   +41 44 633 3076
============================================
The more exotic, the more abstract the knowledge, 
the more profound will be its consequences.
Leon Lederman 
============================================

On 12 May 2021, at 13:13, Philippe Piot <philippe.piot AT gmail.com> wrote:

Dear All,
  I am trying to read the attached json file (with just three samples) with the attached viewjason.py script when I load it I seem to only "see" 1 sample and a 
  X=ds.getData('currFoc') [see my viewjason.py]
only give me a scalar instead of a 3D vector. Thank you for any help. All the best, -- Philippe. 

PS: the ds= load_dataset (...) gives after a print(ds) [I have 9 variables with 40 output recorded] and just made three samples for testing purpose. 

 Sampler dataset.

Number of samplers:  1

Number of samples: 3 per generation

Available design variables (9) :

currFoc            
currMat            
gunE                
gunPhi              
lin1E              
lin1Phi            
lin1dx              
lin1dy              
lsrSzR              

Available objectives (40) :

OBJ1                
OBJ10              
OBJ11              
OBJ12              
OBJ13              
OBJ14              
OBJ15              
OBJ16              
OBJ17              
OBJ18              
OBJ19              
OBJ2                
OBJ20              
OBJ21              
OBJ22              
OBJ23              
OBJ24              
OBJ25              
OBJ26              
OBJ27              
OBJ28              
OBJ29              
OBJ3                
OBJ30              
OBJ31              
OBJ32              
OBJ33              
OBJ34              
OBJ35              
OBJ36              
OBJ37              
OBJ38              
OBJ39              
OBJ4                
OBJ40              
OBJ5                
OBJ6                
OBJ7                
OBJ8                
OBJ9                
<viewJson.py><ML1_samples_0.json>




Archive powered by MHonArc 2.6.19.

Top of Page