Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
0cddcf7
Upload scripts and tools for new simulation model repository
GernotMaier Jan 13, 2025
2139957
integration tests
GernotMaier Jan 13, 2025
5c910c3
docs
GernotMaier Jan 13, 2025
95f2a30
upload production tables
GernotMaier Jan 13, 2025
db7ef4d
add parameter and production model version
GernotMaier Jan 13, 2025
8275d94
New model to upload from repository
GernotMaier Jan 13, 2025
41d834b
upload
GernotMaier Jan 13, 2025
67cc9e7
upload one production table per collection
GernotMaier Jan 14, 2025
364f86b
explicit function statements
GernotMaier Jan 14, 2025
0acbff4
todo
GernotMaier Jan 14, 2025
cab451b
read production tables
GernotMaier Jan 14, 2025
9d52910
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 14, 2025
a64940c
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 14, 2025
6efae01
Add production table
GernotMaier Jan 14, 2025
a13c874
simplification
GernotMaier Jan 14, 2025
8257d27
unit tests for _cache_key
GernotMaier Jan 14, 2025
3446423
remove obsolute code
GernotMaier Jan 14, 2025
0fd6713
read parameters
GernotMaier Jan 14, 2025
b62d9bf
correct handling of configuration production tables
GernotMaier Jan 14, 2025
7fcce3f
simplifications
GernotMaier Jan 14, 2025
791a833
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 15, 2025
877200f
remove db_array_elements
GernotMaier Jan 15, 2025
fd6b788
fix cachte reset
GernotMaier Jan 15, 2025
208313e
new file naming with versioning
GernotMaier Jan 15, 2025
aa72747
bug fix in validating dict (e.g. array layouts)
GernotMaier Jan 15, 2025
220696f
fix printout
GernotMaier Jan 16, 2025
f2261b7
remove duplicated log statement
GernotMaier Jan 16, 2025
8ec92ad
ensure string format in database
GernotMaier Jan 16, 2025
24f4089
Lists as lists and not as strings in model parameters
GernotMaier Jan 16, 2025
d892a95
new model parameter
GernotMaier Jan 16, 2025
4aa2cd1
ensure comparisions lists exist
GernotMaier Jan 16, 2025
cbb3bf6
allow for missing elements in sim_telarray configuration
GernotMaier Jan 16, 2025
b8e2f55
log level
GernotMaier Jan 16, 2025
02272e8
simplified model parameter validation
GernotMaier Jan 16, 2025
d801acd
correct version
GernotMaier Jan 16, 2025
d608740
simplify data validation
GernotMaier Jan 16, 2025
99a99a0
add get parameter using its version
GernotMaier Jan 16, 2025
2142ef8
remove derived
GernotMaier Jan 16, 2025
a6aee68
adjust model parameter validation to new file naming
GernotMaier Jan 16, 2025
e9bd2e5
remove applicable field
GernotMaier Jan 16, 2025
f1602a1
parameter version
GernotMaier Jan 16, 2025
d26e7ef
added schema for production table
GernotMaier Jan 17, 2025
bd0a479
simplified command line
GernotMaier Jan 17, 2025
35dae59
design model
GernotMaier Jan 17, 2025
6e3c6af
integration tests prod6
GernotMaier Jan 17, 2025
1aacd2f
db name in unit and integration tests
GernotMaier Jan 17, 2025
c2e1cee
improved docstring
GernotMaier Jan 17, 2025
4ac29e7
parameter vs model version
GernotMaier Jan 17, 2025
7fb4079
fix db modules
GernotMaier Jan 17, 2025
5c57800
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 17, 2025
71a3e5d
integration test fix
GernotMaier Jan 18, 2025
2b49850
re-enable cache_key
GernotMaier Jan 18, 2025
2cea5ff
remove TODO
GernotMaier Jan 18, 2025
0848c46
unit tests
GernotMaier Jan 18, 2025
42dcbba
unit tests
GernotMaier Jan 18, 2025
5eb4d58
add design model
GernotMaier Jan 19, 2025
f4e20c9
simplifications
GernotMaier Jan 19, 2025
1fda802
new export_model_files api
GernotMaier Jan 19, 2025
bc50739
MB to MByte
GernotMaier Jan 19, 2025
ef2e535
default is MB
GernotMaier Jan 19, 2025
bb34896
fix file uploading
GernotMaier Jan 19, 2025
67a5dd5
fixed docstring
GernotMaier Jan 19, 2025
4f8e877
simplificatons
GernotMaier Jan 19, 2025
ed687b2
fix reading of corsika parameters
GernotMaier Jan 20, 2025
6752c98
improved logger message
GernotMaier Jan 20, 2025
aab80f8
debug
GernotMaier Jan 20, 2025
0fc492a
logging
GernotMaier Jan 20, 2025
3a6c7ce
remove ulr
GernotMaier Jan 20, 2025
84adc11
remove copy_array_element
GernotMaier Jan 20, 2025
dbabe10
unit tests
GernotMaier Jan 20, 2025
3460768
unit tests
GernotMaier Jan 20, 2025
aba9364
unit test fix
GernotMaier Jan 20, 2025
f22f88f
unit tests
GernotMaier Jan 20, 2025
d3dadfc
layout json
GernotMaier Jan 20, 2025
5033e74
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 21, 2025
63efa25
correct DB name
GernotMaier Jan 21, 2025
c3cea59
improved comment
GernotMaier Jan 21, 2025
29b3165
revert numpy version restriction
GernotMaier Jan 21, 2025
d10fc80
fix reading of list of files
GernotMaier Jan 21, 2025
c4d4dc2
consistent requirement for versions
GernotMaier Jan 21, 2025
1060572
correct handling of byte conversion
GernotMaier Jan 21, 2025
0790cb6
docstrings
GernotMaier Jan 21, 2025
d622841
docstrings
GernotMaier Jan 21, 2025
1fca7d6
code smells
GernotMaier Jan 21, 2025
c6ed327
code smells
GernotMaier Jan 21, 2025
c13135c
unit tests
GernotMaier Jan 21, 2025
420ceee
code smells
GernotMaier Jan 21, 2025
cb1dbbd
unit tests for names
GernotMaier Jan 21, 2025
2a1137c
unit tests
GernotMaier Jan 21, 2025
0678955
model validation
GernotMaier Jan 22, 2025
4e34154
integration tests
GernotMaier Jan 22, 2025
3c4cb1e
integration tests
GernotMaier Jan 22, 2025
347a44a
remove debug statements
GernotMaier Jan 22, 2025
530e55e
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 22, 2025
8570ff8
integration tests
GernotMaier Jan 22, 2025
2f591d6
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 22, 2025
61bf61b
unit tests
GernotMaier Jan 22, 2025
69f7b4f
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 22, 2025
fa9e1bc
string fix
GernotMaier Jan 22, 2025
1ce0c39
correct handling of strings vs lists
GernotMaier Jan 22, 2025
cec3944
towncrier doc
GernotMaier Jan 22, 2025
50441bd
Compare lists of floats in json/yaml files
GernotMaier Jan 22, 2025
ae01775
code simplification
GernotMaier Jan 22, 2025
5387876
code simplification
GernotMaier Jan 22, 2025
2eefff7
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 23, 2025
9b3615a
add comment on xSTx
GernotMaier Jan 23, 2025
7fdd30e
Reference model corrections
GernotMaier Jan 26, 2025
d9500b9
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 26, 2025
cdf9136
comments from OG
GernotMaier Jan 26, 2025
6629994
unit test
GernotMaier Jan 26, 2025
62c46f5
fix call for collections
GernotMaier Jan 27, 2025
35b1ce3
code spell
GernotMaier Jan 27, 2025
52c294c
integration tests
GernotMaier Jan 27, 2025
760c145
improved testing
GernotMaier Jan 27, 2025
21e4d5e
Merge branch 'main' into reference-models-corrections
GernotMaier Jan 27, 2025
9e3e082
remove SSTS from dsum and asum_clippling schemas
GernotMaier Jan 27, 2025
34f76c2
SST fixes
GernotMaier Jan 27, 2025
5a5ce31
array window metaschema
GernotMaier Jan 27, 2025
7d73939
Merge branch 'main' into reference-models-corrections
GernotMaier Jan 27, 2025
b355635
OG comments
GernotMaier Jan 27, 2025
2eb8ee5
add parameter name
GernotMaier Jan 28, 2025
82ac448
Allow null for instrument/site; check if files are found
GernotMaier Jan 28, 2025
3cfc813
Merge branch 'main' into new-db-simulation-model-corrections
GernotMaier Jan 28, 2025
6c1a3bf
Merge branch 'main' into db-simulation-model-refactoring
GernotMaier Jan 28, 2025
202aa26
Merge branch 'reference-models-corrections' into new-db-simulation-mo…
GernotMaier Jan 28, 2025
5a0a3a9
Merge branch 'db-simulation-model-refactoring' into new-db-simulation…
GernotMaier Jan 28, 2025
f52a783
Corrections to reference models
GernotMaier Jan 28, 2025
193c1e3
minor source fix
GernotMaier Jan 28, 2025
9bf50b2
Simplifications of get simulation software from parameter name
GernotMaier Jan 28, 2025
5ceedf5
digital sum for MSTs only
GernotMaier Jan 28, 2025
df83775
improve naming
GernotMaier Jan 28, 2025
7f93027
Merge branch 'main' into testing-compare-json
GernotMaier Jan 28, 2025
87aead3
Merge pull request #1330 from gammasim/schema-validation
GernotMaier Jan 28, 2025
65b4ee7
Merge branch 'db-simulation-model-refactoring' into testing-compare-json
GernotMaier Jan 28, 2025
aa58787
Fix integration test depending on json comparison
GernotMaier Jan 28, 2025
102717b
prod5 telescope transmission
GernotMaier Jan 29, 2025
715e1b5
Merge pull request #1331 from gammasim/new-db-simulation-model-correc…
GernotMaier Jan 29, 2025
9735eff
Merge branch 'db-simulation-model-refactoring' into testing-compare-json
GernotMaier Jan 29, 2025
aefe668
fix unit test
GernotMaier Jan 29, 2025
5f59a3a
set trigger current limit to 20 uA
GernotMaier Jan 29, 2025
eba8719
Correct branch to main for simulation model upload
GernotMaier Jan 29, 2025
a49bf7a
Merge pull request #1334 from gammasim/trigger-current-limits
GernotMaier Jan 29, 2025
8ebcbfc
Merge pull request #1335 from gammasim/correct-branch-for-model-upload
GernotMaier Jan 29, 2025
3903f6f
Remove sandboxes
GernotMaier Jan 29, 2025
147670a
Add fake_mirror_list parameter
GernotMaier Jan 30, 2025
2a63629
new validation routine
GernotMaier Jan 30, 2025
4e59984
array coordinate file used in test_array_model export files does not …
GernotMaier Jan 30, 2025
afd5d97
Merge pull request #1319 from gammasim/testing-compare-json
GernotMaier Jan 30, 2025
0df8383
Merge branch 'db-simulation-model-refactoring' into fake-mirror-list
GernotMaier Jan 30, 2025
57fbb9e
Merge branch 'db-simulation-model-refactoring' into grow-out-of-sandb…
GernotMaier Jan 30, 2025
0c242f2
Merge pull request #1338 from gammasim/fake-mirror-list
GernotMaier Jan 30, 2025
d4889d5
Merge branch 'db-simulation-model-refactoring' into grow-out-of-sandb…
GernotMaier Jan 30, 2025
907093d
Merge pull request #1336 from gammasim/grow-out-of-sandboxes
GernotMaier Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env_template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SIMTOOLS_DB_SERVER='cta-simpipe-protodb.zeuthen.desy.de' # MongoDB server
SIMTOOLS_DB_API_USER=YOUR_USERNAME # username for MongoDB: ask the responsible person
SIMTOOLS_DB_API_PW=YOUR_PASSWORD # Password for MongoDB: ask the responsible person
SIMTOOLS_DB_API_AUTHENTICATION_DATABASE='admin'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-Model-LATEST'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-ModelParameters-LATEST'
SIMTOOLS_SIMTEL_PATH='/workdir/sim_telarray'

# The dashboards to monitor the MongoDB instance are in (accessible only from within DESY)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-integrationtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
SIMTOOLS_DB_API_USER: ${{ secrets.DB_API_USER }}
SIMTOOLS_DB_API_PW: ${{ secrets.DB_API_PW }}
SIMTOOLS_DB_API_PORT: ${{ secrets.DB_API_PORT }}
SIMTOOLS_DB_SIMULATION_MODEL: "CTAO-Simulation-Model-LATEST"
SIMTOOLS_DB_SIMULATION_MODEL: "CTAO-Simulation-ModelParameters-LATEST"
SIMTOOLS_SIMTEL_PATH: "/workdir/sim_telarray/"

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
SIMTOOLS_DB_API_USER: ${{ secrets.DB_API_USER }}
SIMTOOLS_DB_API_PW: ${{ secrets.DB_API_PW }}
SIMTOOLS_DB_API_PORT: ${{ secrets.DB_API_PORT }}
SIMTOOLS_DB_SIMULATION_MODEL: "CTAO-Simulation-Model-LATEST"
SIMTOOLS_DB_SIMULATION_MODEL: "CTAO-Simulation-ModelParameters-LATEST"
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

on:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ jobs:
- name: Test Docker image
if: matrix.type == 'prod'
run: >
# Clone simulation model repo for faster file access
git clone https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/model_parameters.git
# run docker
docker run --rm
-e "SIMTOOLS_SIMTEL_PATH='/workdir/sim_telarray'"
-e "SIMTOOLS_DB_API_PORT=${{ env.SIMTOOLS_DB_API_PORT }}"
-e "SIMTOOLS_DB_API_USER=${{ env.SIMTOOLS_DB_API_USER }}"
-e "SIMTOOLS_DB_API_PW=${{ env.SIMTOOLS_DB_API_PW }}"
-e "SIMTOOLS_DB_SERVER=${{ env.SIMTOOLS_DB_SERVER }}"
-e "SIMTOOLS_DB_SIMULATION_MODEL_URL='./model_parameters'"
-v "$(pwd):/workdir/external" ${{ env.TEST_TAG }}
bash -c "cd /workdir/external && simtools-simulate-prod --config /workdir/external/tests/integration_tests/config/simulate_prod_gamma_20_deg_pack_for_grid.yml"
shell: /usr/bin/bash -e {0}
Expand Down
3 changes: 1 addition & 2 deletions database_scripts/upload_dump_to_local_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

SIMTOOLS_NETWORK="simtools-mongo-network"
CONTAINER_NAME="simtools-mongodb"
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-Model-v0-3-0' # Name of the database to be created
SIMTOOLS_DB_SIMULATION_MODEL='Staging-CTA-Simulation-Model-Derived-Values'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-ModelParameters-v0-3-0' # Name of the database to be created

# Check if podman is available, if not use docker
if command -v podman &> /dev/null; then
Expand Down
27 changes: 16 additions & 11 deletions database_scripts/upload_from_model_repository_to_db.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
# Upload model parameter from repository to a local or remote mongoDB.
#
# Execute this scripts from the ./database_scripts directory.
# Cover 'source .env': the script ensure that this file exists:
# shellcheck disable=SC1091

DB_SIMULATION_MODEL_URL="https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/model_parameters.git"
DB_SIMULATION_MODEL_URL="https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/simulation-models.git"
DB_SIMULATION_MODEL_BRANCH="main"

# Check that this script is not sourced but executed
Expand All @@ -27,9 +28,9 @@ echo "Cloning model parameters from $DB_SIMULATION_MODEL_URL"
rm -rf ./tmp_model_parameters
git clone --depth=1 -b $DB_SIMULATION_MODEL_BRANCH $DB_SIMULATION_MODEL_URL ./tmp_model_parameters

CURRENTDIR=$(pwd)
CURRENT_DIR=$(pwd)
cd ./tmp_model_parameters/ || exit
cp -f "$CURRENTDIR"/../.env .env
cp -f "$CURRENT_DIR"/../.env .env

# ask for confirmation before uploading to remote DB
source .env
Expand All @@ -43,16 +44,20 @@ if [[ $SIMTOOLS_DB_SERVER =~ $regex ]]; then
fi
fi

# upload files to DB
model_directory="./model_versions/"
for dir in "${model_directory}"*/; do
simtools-db-add-model-parameters-from-repository-to-db \
--model_version "$(basename "${dir}")" \
--input_path "${dir}" \
# upload model parameters to DB
model_directory="./simulation-models/model_parameters/"
simtools-db-add-simulation-model-from-repository-to-db \
--input_path "${model_directory}" \
--db_name "$DB_SIMULATION_MODEL" \
--type "model_parameters"
done

cd "$CURRENTDIR" || exit
# upload production tables to DB
production_directory="./simulation-models/productions"
simtools-db-add-simulation-model-from-repository-to-db \
--input_path "${production_directory}" \
--db_name "$DB_SIMULATION_MODEL" \
--type "production_tables"

cd "$CURRENT_DIR" || exit

rm -rf ./tmp_model_parameters
1 change: 1 addition & 0 deletions docs/changes/1316.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Major restructering of database routines plus introduction of new simulation model.
6 changes: 3 additions & 3 deletions docs/source/api-reference/db_handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Modules for database access. See the databases sections for details.
:members:
```

## db_array_elements
## db_model_upload

(db-array-elements)=
(db-module-upload)=

```{eval-rst}
.. automodule:: db.db_array_elements
.. automodule:: db.db_model_upload
:members:
```
2 changes: 1 addition & 1 deletion docs/source/user-guide/applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ simtools-convert-all-model-parameters-from-simtel <applications/simtools-convert
simtools-convert-geo-coordinates-of-array-elements <applications/simtools-convert-geo-coordinates-of-array-elements>
simtools-convert-model-parameter-from-simtel <applications/simtools-convert-model-parameter-from-simtel>
simtools-db-add-file-to-db <applications/simtools-db-add-file-to-db>
simtools-db-add-model-parameters-from-repository-to-db <applications/simtools-db-add-model-parameters-from-repository-to-db>
simtools-db-add-simulation-model-from-repository-to-db <applications/simtools-db-add-simulation-model-from-repository-to-db>
simtools-db-add-value-from-json-to-db <applications/simtools-db-add-value-from-json-to-db>
simtools-db-get-array-layouts-from-db <applications/simtools-db-get-array-layouts-from-db>
simtools-db-get-file-from-db <applications/simtools-db-get-file-from-db>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

simtools-db-add-simulation-model-from-repository-to-db
======================================================

.. automodule:: db_add_simulation_model_from_repository_to_db
:members:
22 changes: 6 additions & 16 deletions docs/source/user-guide/databases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Databases

The simtools package uses a prototype MongoDB database to store the simulation model parameters and derived data products.
The simtools package uses a prototype MongoDB database to store the simulation model parameters.
Access to the DB is handled via a dedicated API module ([db_handler](#dbhandler)).

Simulation model parameters are stored in databases (see the [Simulation Model](model_parameters.md#simulation-model) section) and synced with the [CTAO model parameter repository](https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/model_parameters).
Expand All @@ -16,7 +16,7 @@ This documentation is therefore incomplete.

### Model parameters DB

The name of the model parameter database needs to be indicated by `$SIMTOOLS_DB_SIMULATION_MODEL` environmental variable and defined e.g., in the `.env` file. Use `CTAO-Simulation-Model-LATEST` to use the latest version of the CTAO simulation model database (simtools will replace `LATEST` with the latest version number).
The name of the model parameter database needs to be indicated by `$SIMTOOLS_DB_SIMULATION_MODEL` environmental variable and defined e.g., in the `.env` file. Use `CTAO-Simulation-ModelParameters-LATEST` to use the latest version of the CTAO simulation model database (simtools will replace `LATEST` with the latest version number).

Collections:

Expand All @@ -27,15 +27,6 @@ Collections:
* `metadata` containing tables describing the model versions
* `fs.files` with all file type entries for the model parameters (e.g., the quantum-efficiency tables)

### Derived values DB

Database with derived values DB (e.g., `Staging-CTA-Simulation-Model-Derived-Values` defined in `db_handler.DB_DERIVED_VALUES`).

Collections are:

* `derived_values` with the derived values for each telescope or site
* `fs.files` with file type derived results

### Other databases

All other currently available databases are not in use and kept for historical reasons.
Expand All @@ -52,8 +43,7 @@ SIMTOOLS_DB_SERVER='cta-simpipe-protodb.zeuthen.desy.de' # MongoDB server
SIMTOOLS_DB_API_USER=YOUR_USERNAME # username for MongoDB: ask the responsible person
SIMTOOLS_DB_API_PW=YOUR_PASSWORD # Password for MongoDB: ask the responsible person
SIMTOOLS_DB_API_AUTHENTICATION_DATABASE='admin'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-Model-LATEST'
# SIMTOOLS_DB_SIMULATION_MODEL_URL=''
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-ModelParameters-LATEST'
SIMTOOLS_SIMTEL_PATH='/workdir/sim_telarray'
```

Expand All @@ -75,7 +65,7 @@ The following applications are important:

* update or define a single model parameter from a json file (as defined in the model parameter repository): [db_add_value_from_json_to_db.py](db_add_value_from_json_to_db)
* upload a model parameter file: [db_add_file_to_db.py](db_add_file_to_db)
* upload all model parameters and files from the model parameter repository: [db_add_model_parameters_from_repository_to_db.py](db_add_model_parameters_from_repository_to_db)
* upload all model parameters and files from the model parameter repository: [db_add_simulation_model_from_repository_to_db.py](db_add_simulation_model_from_repository_to_db)

## Configure and use a local copy of the model parameter database

Expand Down Expand Up @@ -138,7 +128,7 @@ SIMTOOLS_DB_API_AUTHENTICATION_DATABASE='admin'
SIMTOOLS_DB_SIMULATION_MODEL='STAGING-CTA-Simulation-Model-LATEST'
```

`SIMTOOLS_DB_SIMULATION_MODEL` is set as an example here to `STAGING-CTAO-Simulation-Model-LATEST` and should be changed accordingly.
`SIMTOOLS_DB_SIMULATION_MODEL` is set as an example here to `STAGING-CTAO-Simulation-ModelParameters-LATEST` and should be changed accordingly.

For using simtools inside a container:

Expand All @@ -158,6 +148,6 @@ SIMTOOLS_DB_SERVER='simtools-mongodb'
SIMTOOLS_DB_API_USER='api' # username for MongoDB
SIMTOOLS_DB_API_PW='password' # Password for MongoDB
SIMTOOLS_DB_API_AUTHENTICATION_DATABASE='admin'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-Model-LATEST'
SIMTOOLS_DB_SIMULATION_MODEL='CTAO-Simulation-ModelParameters-LATEST'
SIMTOOLS_SIMTEL_PATH='/workdir/sim_telarray'
```
5 changes: 3 additions & 2 deletions docs/source/user-guide/model_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,15 @@ A typical model parameter file looks like:

```json
{
"schema_version": "0.1.0",
"parameter": "num_gains",
"instrument": "LSTN-01",
"site": "North",
"version": "6.0.0",
"parameter_version": "6.0.0",
"unique_id": null,
"value": 2,
"unit": null,
"type": "int64",
"applicable": true,
"file": false
}
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ scripts.simtools-convert-all-model-parameters-from-simtel = "simtools.applicatio
scripts.simtools-convert-geo-coordinates-of-array-elements = "simtools.applications.convert_geo_coordinates_of_array_elements:main"
scripts.simtools-convert-model-parameter-from-simtel = "simtools.applications.convert_model_parameter_from_simtel:main"
scripts.simtools-db-add-file-to-db = "simtools.applications.db_add_file_to_db:main"
scripts.simtools-db-add-model-parameters-from-repository-to-db = "simtools.applications.db_add_model_parameters_from_repository_to_db:main"
scripts.simtools-db-add-simulation-model-from-repository-to-db = "simtools.applications.db_add_simulation_model_from_repository_to_db:main"
scripts.simtools-db-add-value-from-json-to-db = "simtools.applications.db_add_value_from_json_to_db:main"
scripts.simtools-db-get-array-layouts-from-db = "simtools.applications.db_get_array_layouts_from_db:main"
scripts.simtools-db-get-file-from-db = "simtools.applications.db_get_file_from_db:main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
ready to be submitted to the model database. Prints out parameters which are not found
in simtel configuration file and parameters which are not found in simtools schema files.

Note that all parameters are assigned the same parameter version.

Command line arguments
----------------------
simtel_cfg_file (str)
Expand All @@ -30,7 +32,7 @@
--simtel_cfg_file all_telescope_config_la_palma.cfg\\
--simtel_telescope_name CT1\\
--telescope LSTN-01\\
--model_version "2024-03-06"
--parameter_version "1.0.0"

The export of the model parameters from sim_telarray for 6.0.0 can be done e.g., as follows:

Expand Down Expand Up @@ -103,7 +105,7 @@ def _parse(label=None, description=None):
type=str,
required=True,
)
return config.initialize(simulation_model=["telescope", "model_version"])
return config.initialize(simulation_model=["telescope", "parameter_version"])


def get_list_of_parameters_and_schema_files(schema_directory):
Expand Down Expand Up @@ -219,7 +221,6 @@ def read_and_export_parameters(args_dict, logger):
"""
Read and export parameters from simtel configuration file to json files.

Only applicable parameters are exported to json.
Provide extensive logging information on the parameters found in the simtel
configuration file.

Expand Down Expand Up @@ -266,7 +267,7 @@ def read_and_export_parameters(args_dict, logger):
parameter_name=_parameter,
value=simtel_config_reader.parameter_dict.get(args_dict["simtel_telescope_name"]),
instrument=args_dict["telescope"],
model_version=args_dict["model_version"],
parameter_version=args_dict["parameter_version"],
output_file=io_handler.get_output_file(f"{_parameter}.json"),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _parse(label=None, description=None):
output=True,
require_command_line=True,
db_config=True,
simulation_model=["model_version", "site"],
simulation_model=["model_version", "parameter_version", "site"],
)


Expand Down Expand Up @@ -170,7 +170,9 @@ def main():

if args_dict["export"] is not None:
product_data = (
layout.export_one_telescope_as_json(crs_name=args_dict["export"])
layout.export_one_telescope_as_json(
crs_name=args_dict["export"], parameter_version=args_dict.get("parameter_version")
)
if args_dict.get("input", "").endswith(".json")
else layout.export_telescope_list_table(crs_name=args_dict["export"])
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _parse(label=None, description=None):
type=str,
required=True,
)
return config.initialize(simulation_model=["telescope", "model_version"], output=True)
return config.initialize(simulation_model=["telescope", "parameter_version"], output=True)


def main(): # noqa: D103
Expand Down Expand Up @@ -107,7 +107,7 @@ def main(): # noqa: D103
parameter_name=simtel_config_reader.parameter_name,
value=simtel_config_reader.parameter_dict.get(args_dict["simtel_telescope_name"]),
instrument=args_dict["telescope"],
model_version=args_dict["model_version"],
parameter_version=args_dict["parameter_version"],
output_file=args_dict["output_file"],
output_path=args_dict.get("output_path"),
use_plain_output_path=args_dict.get("use_plain_output_path"),
Expand Down
3 changes: 1 addition & 2 deletions src/simtools/applications/db_add_file_to_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
A directory with files to upload to the DB. \
All files in the directory with a predefined list of extensions will be uploaded.
db (str)
The DB to insert the files to. \
The choices are either the default CTA simulation DB or a sandbox for testing.
The DB to insert the files to.

Example
-------
Expand Down
Loading