![]() |
COMPASS
5.0.0
End-to-end AO simulation tool using GPU acceleration
|
Functions for handling the database system. More...
Functions | |
def | updateParamDict (pdict, pClass, prefix) |
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... | |
Functions for handling the database system.
This file is part of COMPASS https://anr-compass.github.io/compass/
Copyright (C) 2011-2019 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.
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 366 of file hdf5_util.py.
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 430 of file hdf5_util.py.
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:
matricesToLoad (dictionary) : matrices that will be load and their path
Definition at line 282 of file hdf5_util.py.
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 309 of file hdf5_util.py.
def shesha.util.hdf5_util.configFromH5 | ( | filename, | |
config | |||
) |
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
:param:
filename (str) : full path + filename to create
config () : simulation parameters
Definition at line 130 of file hdf5_util.py.
def shesha.util.hdf5_util.init_hdf5_files | ( | savepath, | |
param_dict, | |||
matricesToLoad | |||
) |
TODO docstring.
Definition at line 150 of file hdf5_util.py.
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 184 of file hdf5_util.py.
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 688 of file hdf5_util.py.
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 736 of file hdf5_util.py.
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 788 of file hdf5_util.py.
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.
:param config: (module) : simulation parameters
:return param_dict: (dictionary) : dictionary of parameters
Definition at line 86 of file hdf5_util.py.
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 672 of file hdf5_util.py.
def shesha.util.hdf5_util.save_AB_in_database | ( | k, | |
A, | |||
B, | |||
istx, | |||
isty | |||
) |
Save A, B, istx and isty in the database.
:parameters:
ind:
istx: isty:
Definition at line 714 of file hdf5_util.py.
def shesha.util.hdf5_util.save_dm_geom_in_dataBase | ( | ndm, | |
influpos, | |||
ninflu, | |||
influstart, | |||
i1, | |||
j1, | |||
ok | |||
) |
Save the DM geometry in the database.
:parameters:
ndm: influpos: ninflu: influstart: i1: j1:
Definition at line 766 of file hdf5_util.py.
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
:param:
filename (str) : full path to the file
dataname (str) : name of the data (imat, cmat...)
config (module) : config parameters
data np.array : data to save
Definition at line 257 of file hdf5_util.py.
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
:param:
filename (str) : full path to the file
dataname (str) : name of the data (imat, cmat...)
data np.array : data to save
Definition at line 237 of file hdf5_util.py.
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 803 of file hdf5_util.py.
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 209 of file hdf5_util.py.
def shesha.util.hdf5_util.updateParamDict | ( | pdict, | |
pClass, | |||
prefix | |||
) |
def shesha.util.hdf5_util.validDataBase | ( | savepath, | |
matricesToLoad | |||
) |
TODO docstring.
Definition at line 480 of file hdf5_util.py.
def shesha.util.hdf5_util.validFile | ( | filename | ) |
TODO docstring.
Definition at line 493 of file hdf5_util.py.
def shesha.util.hdf5_util.validInStore | ( | store, | |
savepath, | |||
matricetype | |||
) |
TODO docstring.
Definition at line 501 of file hdf5_util.py.
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
:parametres:
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 657 of file hdf5_util.py.