COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
shesha.util.hdf5_util Namespace Reference

Functions for handling the database system. More...

Functions

def updateParamDict (pdict, pClass, prefix)
 Update parameters dictionnary pdict with all the parameters of pClass. More...
 
def params_dictionary (config)
 Create and returns a dictionary of all the config parameters with the corresponding keys for further creation of database and save files. More...
 
def create_file_attributes (filename, param_dict)
 create_file_attributes(filename,config) Create an hdf5 file wtih attributes corresponding to all simulation parameters More...
 
def init_hdf5_files (savepath, param_dict, matricesToLoad)
 TODO docstring. More...
 
def initDataBase (savepath, param_dict)
 Initialize and create the database for all the saved matrices. More...
 
def updateDataBase (h5file, savepath, matrix_type)
 Update the database adding a new row to the matrix_type database. More...
 
def save_hdf5 (filename, dataname, data)
 save_hdf5(filename, dataname, data) Create a dataset in an existing hdf5 file filename and store data in it More...
 
def save_h5 (filename, dataname, config, data)
 save_hdf5(filename, dataname, config, data) Create a hdf5 file and store data in it with full header from config parameters Usefull to backtrace data origins More...
 
def checkMatricesDataBase (savepath, config, param_dict)
 Check in the database if the current config have been already run. More...
 
def checkTurbuParams (savepath, config, pdict, matricesToLoad)
 Compare the current turbulence parameters to the database. More...
 
def checkControlParams (savepath, config, pdict, matricesToLoad)
 Compare the current controller parameters to the database. More...
 
def checkDmsParams (savepath, config, pdict, matricesToLoad)
 Compare the current controller parameters to the database. More...
 
def validDataBase (savepath, matricesToLoad)
 TODO docstring. More...
 
def validFile (filename)
 TODO docstring. More...
 
def validInStore (store, savepath, matricetype)
 TODO docstring. More...
 
def configFromH5 (filename, config)
 TODO docstring. More...
 
def writeHdf5SingleDataset (filename, data, datasetName="dataset")
 Write a hdf5 file containig a single field. More...
 
def readHdf5SingleDataset (filename, datasetName="dataset")
 Read a single dataset from an hdf5 file. More...
 
def load_AB_from_dataBase (database, ind)
 Read and return A, B, istx and isty from the database. More...
 
def save_AB_in_database (k, A, B, istx, isty)
 Save A, B, istx and isty in the database. More...
 
def load_dm_geom_from_dataBase (database, ndm)
 Read and return the DM geometry. More...
 
def save_dm_geom_in_dataBase (ndm, influpos, ninflu, influstart, i1, j1, ok)
 Save the DM geometry in the database. More...
 
def load_imat_from_dataBase (database)
 Read and return the imat. More...
 
def save_imat_in_dataBase (imat)
 Save the DM geometry in the database. More...
 

Detailed Description

Functions for handling the database system.

Author
COMPASS Team https://github.com/ANR-COMPASS
Version
5.4.4
Date
2022/01/24

This file is part of COMPASS https://anr-compass.github.io/compass/

Copyright (C) 2011-2023 COMPASS Team https://github.com/ANR-COMPASS All rights reserved. Distributed under GNU - LGPL

COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

COMPASS: End-to-end AO simulation tool using GPU acceleration The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.

The final product includes a software package for simulating all the critical subcomponents of AO, particularly in the context of the ELT and a real-time core based on several control approaches, with performances consistent with its integration into an instrument. Taking advantage of the specific hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to conduct large simulation campaigns called to the ELT.

The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and various systems configurations such as multi-conjugate AO.

COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with COMPASS. If not, see https://www.gnu.org/licenses/lgpl-3.0.txt.

Function Documentation

◆ checkControlParams()

def shesha.util.hdf5_util.checkControlParams (   savepath,
  config,
  pdict,
  matricesToLoad 
)

Compare the current controller parameters to the database.

If similar parameters are found, matricesToLoad dictionary is completed. Since all the controller matrices are computed together, we only check the parameters for the imat matrix : if we load imat, we load eigenv and U too.

Parameters
config(module) : simulation parameters
matricesToLoad(dictionary) : matrices that will be load and their path

Definition at line 369 of file hdf5_util.py.

Here is the caller graph for this function:

◆ checkDmsParams()

def shesha.util.hdf5_util.checkDmsParams (   savepath,
  config,
  pdict,
  matricesToLoad 
)

Compare the current controller parameters to the database.

If similar parameters are found, matricesToLoad dictionary is completed. Since all the dms matrices are computed together, we only check the parameters for the pztok matrix : if we load pztok, we load pztnok too.

Parameters
config(module) : simulation parameters
matricesToLoad(dictionary) : matrices that will be load and their path

Definition at line 433 of file hdf5_util.py.

Here is the caller graph for this function:

◆ checkMatricesDataBase()

def shesha.util.hdf5_util.checkMatricesDataBase (   savepath,
  config,
  param_dict 
)

Check in the database if the current config have been already run.

If so, return a dictionary containing the matrices to load and their path. Matrices which don't appear in the dictionary will be computed, stored and added to the database during the simulation. If the database doesn't exist, this function creates it.

Parameters
savepath(str) : path to the data repertory
config(module) : simulation parameters
param_dict(dictionary) : parameters dictionary

:return:

Parameters
matricesToLoad(dictionary) : matrices that will be load and their path

Definition at line 285 of file hdf5_util.py.

Here is the call graph for this function:

◆ checkTurbuParams()

def shesha.util.hdf5_util.checkTurbuParams (   savepath,
  config,
  pdict,
  matricesToLoad 
)

Compare the current turbulence parameters to the database.

If similar parameters are found, the matricesToLoad dictionary is completed. Since all the turbulence matrices are computed together, we only check the parameters for the A matrix : if we load A, we load B, istx and isty too.

Parameters
config(module) : simulation parameters
matricesToLoad(dictionary) : matrices that will be load and their path

Definition at line 312 of file hdf5_util.py.

Here is the caller graph for this function:

◆ configFromH5()

def shesha.util.hdf5_util.configFromH5 (   filename,
  config 
)

TODO docstring.

Definition at line 514 of file hdf5_util.py.

◆ create_file_attributes()

def shesha.util.hdf5_util.create_file_attributes (   filename,
  param_dict 
)

create_file_attributes(filename,config) Create an hdf5 file wtih attributes corresponding to all simulation parameters

Parameters

Definition at line 122 of file hdf5_util.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_hdf5_files()

def shesha.util.hdf5_util.init_hdf5_files (   savepath,
  param_dict,
  matricesToLoad 
)

TODO docstring.

Definition at line 151 of file hdf5_util.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initDataBase()

def shesha.util.hdf5_util.initDataBase (   savepath,
  param_dict 
)

Initialize and create the database for all the saved matrices.

This database will be placed on the top of the savepath and be named matricesDataBase.h5.

Parameters
savepath(str) : path to the data repertory
param_dict(dictionary) : parameters dictionary

Definition at line 185 of file hdf5_util.py.

Here is the caller graph for this function:

◆ load_AB_from_dataBase()

def shesha.util.hdf5_util.load_AB_from_dataBase (   database,
  ind 
)

Read and return A, B, istx and isty from the database.

Parameters
database(dict): dictionary containing paths to matrices to load
ind(int): layer index

Definition at line 691 of file hdf5_util.py.

◆ load_dm_geom_from_dataBase()

def shesha.util.hdf5_util.load_dm_geom_from_dataBase (   database,
  ndm 
)

Read and return the DM geometry.

Parameters
database(dict): dictionary containing paths to matrices to load
ndm(int): dm index

Definition at line 739 of file hdf5_util.py.

◆ load_imat_from_dataBase()

def shesha.util.hdf5_util.load_imat_from_dataBase (   database)

Read and return the imat.

Parameters
database(dict): dictionary containing paths to matrices to load

Definition at line 791 of file hdf5_util.py.

◆ params_dictionary()

def shesha.util.hdf5_util.params_dictionary (   config)

Create and returns a dictionary of all the config parameters with the corresponding keys for further creation of database and save files.

Parameters
config(module) : simulation parameters
Returns
param_dict: (dictionary) dictionary of parameters

Definition at line 78 of file hdf5_util.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readHdf5SingleDataset()

def shesha.util.hdf5_util.readHdf5SingleDataset (   filename,
  datasetName = "dataset" 
)

Read a single dataset from an hdf5 file.

Parameters
filename(str) : name of the file to read from
datasetName(str) : name of the dataset to read (default="dataset")

Definition at line 675 of file hdf5_util.py.

◆ save_AB_in_database()

def shesha.util.hdf5_util.save_AB_in_database (   k,
  A,
  B,
  istx,
  isty 
)

Save A, B, istx and isty in the database.

    ind:
A
B
   istx:

   isty:

Definition at line 717 of file hdf5_util.py.

Here is the call graph for this function:

◆ save_dm_geom_in_dataBase()

def shesha.util.hdf5_util.save_dm_geom_in_dataBase (   ndm,
  influpos,
  ninflu,
  influstart,
  i1,
  j1,
  ok 
)

Save the DM geometry in the database.

    ndm:

    influpos:

    ninflu:

    influstart:

    i1:

    j1:

Definition at line 769 of file hdf5_util.py.

Here is the call graph for this function:

◆ save_h5()

def shesha.util.hdf5_util.save_h5 (   filename,
  dataname,
  config,
  data 
)

save_hdf5(filename, dataname, config, data) Create a hdf5 file and store data in it with full header from config parameters Usefull to backtrace data origins

Parameters

Definition at line 260 of file hdf5_util.py.

Here is the call graph for this function:

◆ save_hdf5()

def shesha.util.hdf5_util.save_hdf5 (   filename,
  dataname,
  data 
)

save_hdf5(filename, dataname, data) Create a dataset in an existing hdf5 file filename and store data in it

Parameters

Definition at line 240 of file hdf5_util.py.

Here is the caller graph for this function:

◆ save_imat_in_dataBase()

def shesha.util.hdf5_util.save_imat_in_dataBase (   imat)

Save the DM geometry in the database.

Parameters
imat(np.ndarray): imat to save

Definition at line 806 of file hdf5_util.py.

Here is the call graph for this function:

◆ updateDataBase()

def shesha.util.hdf5_util.updateDataBase (   h5file,
  savepath,
  matrix_type 
)

Update the database adding a new row to the matrix_type database.

Parameters
h5file(str) : path to the new h5 file to add
savepath(str) : path to the data directory
matrix_type(str) : type of matrix to store ("A","B","istx","isty"
"istx","eigenv","imat","U"
"pztok" or "pztnok")

Definition at line 212 of file hdf5_util.py.

Here is the caller graph for this function:

◆ updateParamDict()

def shesha.util.hdf5_util.updateParamDict (   pdict,
  pClass,
  prefix 
)

Update parameters dictionnary pdict with all the parameters of pClass.

Prefix must be set to define the key value of the new dict entries

Definition at line 49 of file hdf5_util.py.

Here is the caller graph for this function:

◆ validDataBase()

def shesha.util.hdf5_util.validDataBase (   savepath,
  matricesToLoad 
)

TODO docstring.

Definition at line 483 of file hdf5_util.py.

Here is the call graph for this function:

◆ validFile()

def shesha.util.hdf5_util.validFile (   filename)

TODO docstring.

Definition at line 496 of file hdf5_util.py.

Here is the caller graph for this function:

◆ validInStore()

def shesha.util.hdf5_util.validInStore (   store,
  savepath,
  matricetype 
)

TODO docstring.

Definition at line 504 of file hdf5_util.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeHdf5SingleDataset()

def shesha.util.hdf5_util.writeHdf5SingleDataset (   filename,
  data,
  datasetName = "dataset" 
)

Write a hdf5 file containig a single field.

If the file already exists, it will be overwritten

Parameters
etres
filename(str) : name of the file to write
data(np.ndarray) : content of the file
datasetName(str) : name of the dataset to write (default="dataset")

Definition at line 660 of file hdf5_util.py.