![]() |
COMPASS
5.4.4
End-to-end AO simulation tool using GPU acceleration
|
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... | |
Functions for handling the database system.
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.
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.
config | (module) : simulation parameters |
matricesToLoad | (dictionary) : matrices that will be load and their path |
Definition at line 369 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.
config | (module) : simulation parameters |
matricesToLoad | (dictionary) : matrices that will be load and their path |
Definition at line 433 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.
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 285 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.
config | (module) : simulation parameters |
matricesToLoad | (dictionary) : matrices that will be load and their path |
Definition at line 312 of file hdf5_util.py.
def shesha.util.hdf5_util.configFromH5 | ( | filename, | |
config | |||
) |
TODO docstring.
Definition at line 514 of file hdf5_util.py.
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
Definition at line 122 of file hdf5_util.py.
def shesha.util.hdf5_util.init_hdf5_files | ( | savepath, | |
param_dict, | |||
matricesToLoad | |||
) |
TODO docstring.
Definition at line 151 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.
savepath | (str) : path to the data repertory |
param_dict | (dictionary) : parameters dictionary |
Definition at line 185 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.
database | (dict): dictionary containing paths to matrices to load |
ind | (int): layer index |
Definition at line 691 of file hdf5_util.py.
def shesha.util.hdf5_util.load_dm_geom_from_dataBase | ( | database, | |
ndm | |||
) |
Read and return the DM geometry.
database | (dict): dictionary containing paths to matrices to load |
ndm | (int): dm index |
Definition at line 739 of file hdf5_util.py.
def shesha.util.hdf5_util.load_imat_from_dataBase | ( | database | ) |
Read and return the imat.
database | (dict): dictionary containing paths to matrices to load |
Definition at line 791 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.
config | (module) : simulation parameters |
Definition at line 78 of file hdf5_util.py.
def shesha.util.hdf5_util.readHdf5SingleDataset | ( | filename, | |
datasetName = "dataset" |
|||
) |
Read a single dataset from an hdf5 file.
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.
def shesha.util.hdf5_util.save_AB_in_database | ( | k, | |
A, | |||
B, | |||
istx, | |||
isty | |||
) |
Save A, B, istx and isty in the database.
ind:
istx: isty:
Definition at line 717 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.
ndm: influpos: ninflu: influstart: i1: j1:
Definition at line 769 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
Definition at line 260 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
Definition at line 240 of file hdf5_util.py.
def shesha.util.hdf5_util.save_imat_in_dataBase | ( | imat | ) |
Save the DM geometry in the database.
imat | (np.ndarray): imat to save |
Definition at line 806 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.
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"
|
Definition at line 212 of file hdf5_util.py.
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.
def shesha.util.hdf5_util.validDataBase | ( | savepath, | |
matricesToLoad | |||
) |
TODO docstring.
Definition at line 483 of file hdf5_util.py.
def shesha.util.hdf5_util.validFile | ( | filename | ) |
TODO docstring.
Definition at line 496 of file hdf5_util.py.
def shesha.util.hdf5_util.validInStore | ( | store, | |
savepath, | |||
matricetype | |||
) |
TODO docstring.
Definition at line 504 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
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.