gammasimtools 0.5.1__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/METADATA +80 -28
  2. gammasimtools-0.6.1.dist-info/RECORD +91 -0
  3. {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/WHEEL +1 -1
  4. {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/entry_points.txt +4 -2
  5. simtools/_version.py +14 -2
  6. simtools/applications/add_file_to_db.py +2 -1
  7. simtools/applications/compare_cumulative_psf.py +10 -15
  8. simtools/applications/db_development_tools/add_new_parameter_to_db.py +12 -6
  9. simtools/applications/derive_mirror_rnda.py +95 -71
  10. simtools/applications/generate_corsika_histograms.py +216 -131
  11. simtools/applications/generate_default_metadata.py +110 -0
  12. simtools/applications/generate_simtel_array_histograms.py +192 -0
  13. simtools/applications/get_file_from_db.py +1 -1
  14. simtools/applications/get_parameter.py +3 -3
  15. simtools/applications/make_regular_arrays.py +89 -93
  16. simtools/applications/{plot_layout_array.py → plot_array_layout.py} +15 -14
  17. simtools/applications/print_array_elements.py +81 -34
  18. simtools/applications/produce_array_config.py +2 -2
  19. simtools/applications/production.py +39 -5
  20. simtools/applications/sim_showers_for_trigger_rates.py +26 -30
  21. simtools/applications/simulate_prod.py +49 -107
  22. simtools/applications/submit_data_from_external.py +8 -10
  23. simtools/applications/tune_psf.py +16 -18
  24. simtools/applications/validate_camera_efficiency.py +63 -9
  25. simtools/applications/validate_camera_fov.py +9 -13
  26. simtools/applications/validate_file_using_schema.py +127 -0
  27. simtools/applications/validate_optics.py +13 -15
  28. simtools/camera_efficiency.py +73 -80
  29. simtools/configuration/commandline_parser.py +52 -22
  30. simtools/configuration/configurator.py +98 -33
  31. simtools/constants.py +9 -0
  32. simtools/corsika/corsika_config.py +28 -22
  33. simtools/corsika/corsika_default_config.py +282 -0
  34. simtools/corsika/corsika_histograms.py +328 -282
  35. simtools/corsika/corsika_histograms_visualize.py +162 -163
  36. simtools/corsika/corsika_runner.py +8 -4
  37. simtools/corsika_simtel/corsika_simtel_runner.py +18 -23
  38. simtools/data_model/data_reader.py +129 -0
  39. simtools/data_model/metadata_collector.py +346 -118
  40. simtools/data_model/metadata_model.py +123 -218
  41. simtools/data_model/model_data_writer.py +79 -22
  42. simtools/data_model/validate_data.py +96 -46
  43. simtools/db_handler.py +67 -42
  44. simtools/io_operations/__init__.py +0 -0
  45. simtools/io_operations/hdf5_handler.py +112 -0
  46. simtools/{io_handler.py → io_operations/io_handler.py} +51 -22
  47. simtools/job_execution/job_manager.py +1 -1
  48. simtools/layout/{layout_array.py → array_layout.py} +168 -199
  49. simtools/layout/geo_coordinates.py +196 -0
  50. simtools/layout/telescope_position.py +12 -12
  51. simtools/model/array_model.py +16 -14
  52. simtools/model/camera.py +5 -8
  53. simtools/model/mirrors.py +136 -73
  54. simtools/model/model_utils.py +1 -69
  55. simtools/model/telescope_model.py +32 -25
  56. simtools/psf_analysis.py +26 -19
  57. simtools/ray_tracing.py +54 -26
  58. simtools/schemas/data.metaschema.yml +400 -0
  59. simtools/schemas/metadata.metaschema.yml +566 -0
  60. simtools/simtel/simtel_config_writer.py +14 -5
  61. simtools/simtel/simtel_histograms.py +266 -83
  62. simtools/simtel/simtel_runner.py +8 -7
  63. simtools/simtel/simtel_runner_array.py +7 -8
  64. simtools/simtel/simtel_runner_camera_efficiency.py +48 -2
  65. simtools/simtel/simtel_runner_ray_tracing.py +61 -25
  66. simtools/simulator.py +43 -50
  67. simtools/utils/general.py +232 -286
  68. simtools/utils/geometry.py +163 -0
  69. simtools/utils/names.py +294 -142
  70. simtools/visualization/legend_handlers.py +115 -9
  71. simtools/visualization/visualize.py +13 -13
  72. gammasimtools-0.5.1.dist-info/RECORD +0 -83
  73. simtools/applications/plot_simtel_histograms.py +0 -120
  74. simtools/applications/validate_schema_files.py +0 -135
  75. simtools/corsika/corsika_output_visualize.py +0 -345
  76. simtools/data_model/validate_schema.py +0 -285
  77. {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/LICENSE +0 -0
  78. {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,566 @@
1
+ ---
2
+ $schema: http://json-schema.org/draft-06/schema#
3
+ $ref: '#/definitions/SimtoolsOutputMetadata'
4
+ title: SimPipe Output Metadata Metaschema
5
+ description: YAML representation of model parameter metaschema
6
+ version: 0.1.0
7
+ name: metadata.metaschema
8
+ type: object
9
+ additionalProperties: false
10
+
11
+
12
+ definitions:
13
+ SimtoolsOutputMetadata:
14
+ type: object
15
+ additionalProperties: false
16
+ properties:
17
+ CTA:
18
+ $ref: '#/definitions/CTA'
19
+ required:
20
+ - CTA
21
+ description: SimPipe metadata definition
22
+ CTA:
23
+ type: object
24
+ required:
25
+ - ACTIVITY
26
+ - CONTACT
27
+ - INSTRUMENT
28
+ - PROCESS
29
+ - PRODUCT
30
+ - REFERENCE
31
+ additionalProperties: false
32
+ properties:
33
+ ###############
34
+ REFERENCE:
35
+ description: Reference fields
36
+ required:
37
+ - VERSION
38
+ type: object
39
+ additionalProperties: false
40
+ properties:
41
+ VERSION:
42
+ type: string
43
+ description: |-
44
+ Version of the Reference metadata schema used in the data product
45
+ default: 1.0.0
46
+ pattern: "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
47
+ ###############
48
+ CONTACT:
49
+ title: Contact
50
+ description: |-
51
+ Describes the person or institution that is responsible for this
52
+ data product.
53
+ required:
54
+ - EMAIL
55
+ - NAME
56
+ - ORGANIZATION
57
+ type: object
58
+ additionalProperties: false
59
+ properties:
60
+ ORGANIZATION:
61
+ type: string
62
+ description: |-
63
+ Organization to which this data product is associated
64
+ default: CTAO
65
+ NAME:
66
+ description: |-
67
+ Name of contact within the organization
68
+ anyOf:
69
+ - type: string
70
+ - type: "null"
71
+ default: null
72
+ EMAIL:
73
+ description: Contact email address
74
+ anyOf:
75
+ - type: string
76
+ format: email
77
+ - type: "null"
78
+ default: null
79
+ ###############
80
+ PRODUCT:
81
+ title: Product
82
+ description: |-
83
+ Describes the details of the data product, including its type and
84
+ links to the data model definition.
85
+ required:
86
+ - DATA
87
+ - DESCRIPTION
88
+ - FORMAT
89
+ - ID
90
+ - VALID
91
+ type: object
92
+ additionalProperties: false
93
+ properties:
94
+ DESCRIPTION:
95
+ anyOf:
96
+ - type: string
97
+ - type: "null"
98
+ default: null
99
+ description: Product description
100
+ CREATION_TIME:
101
+ anyOf:
102
+ - type: string
103
+ format: date-time
104
+ - type: "null"
105
+ format: date-time
106
+ default: null
107
+ description: |-
108
+ Human-readable date and time of file creation, in ISO format.
109
+ ID:
110
+ anyOf:
111
+ - type: string
112
+ format: uuid
113
+ - type: "null"
114
+ - type: number
115
+ default: null
116
+ description: |-
117
+ Product identifier.
118
+ DATA:
119
+ title: Data
120
+ required:
121
+ - CATEGORY
122
+ - ASSOCIATION
123
+ - LEVEL
124
+ - MODEL
125
+ type: object
126
+ additionalProperties: false
127
+ properties:
128
+ CATEGORY:
129
+ anyOf:
130
+ - type: string
131
+ - type: "null"
132
+ default: null
133
+ description: |-
134
+ CTA data identifier
135
+ enum:
136
+ - SIM
137
+ - CAL
138
+ - null
139
+ ASSOCIATION:
140
+ anyOf:
141
+ - type: "null"
142
+ - type: string
143
+ default: null
144
+ description: |-
145
+ Array element association.
146
+ enum:
147
+ - CTA
148
+ - Site
149
+ - Subarray
150
+ - Telescope
151
+ - Target
152
+ - null
153
+ LEVEL:
154
+ anyOf:
155
+ - type: string
156
+ - type: "null"
157
+ default: null
158
+ description: |-
159
+ CTA data level
160
+ enum:
161
+ - R0
162
+ - R1
163
+ - DL0
164
+ - DL1
165
+ - DL2
166
+ - DL3
167
+ - DL4
168
+ - DL5
169
+ - DL6
170
+ - null
171
+ TYPE:
172
+ anyOf:
173
+ - type: string
174
+ - type: "null"
175
+ default: null
176
+ description: |-
177
+ CTA data type.
178
+ enum:
179
+ - Event
180
+ - Monitoring
181
+ - Service
182
+ - DataCube
183
+ - Catalog
184
+ - null
185
+ MODEL:
186
+ title: Model
187
+ required:
188
+ - NAME
189
+ - VERSION
190
+ type: object
191
+ additionalProperties: false
192
+ properties:
193
+ NAME:
194
+ anyOf:
195
+ - type: string
196
+ - type: "null"
197
+ default: null
198
+ description: |-
199
+ Identifying name of the data model used.
200
+ VERSION:
201
+ anyOf:
202
+ - type: string
203
+ - type: "null"
204
+ default: null
205
+ description: |-
206
+ Version of the data model used.
207
+ URL:
208
+ description: |-
209
+ Link to definition of data model.
210
+ anyOf:
211
+ - type: string
212
+ format: uri
213
+ - type: "null"
214
+ default: null
215
+ TYPE:
216
+ description: |-
217
+ Type of data model (e.g. simpipe-schema).
218
+ anyOf:
219
+ - type: string
220
+ - type: "null"
221
+ default: null
222
+ SUBTYPE:
223
+ description: |-
224
+ Additional subtype of data model.
225
+ anyOf:
226
+ - type: string
227
+ - type: "null"
228
+ FORMAT:
229
+ anyOf:
230
+ - type: string
231
+ - type: "null"
232
+ default: null
233
+ VALID:
234
+ type: object
235
+ additionalProperties: false
236
+ properties:
237
+ START:
238
+ anyOf:
239
+ - type: string
240
+ format: date-time
241
+ - type: "null"
242
+ default: null
243
+ END:
244
+ anyOf:
245
+ - type: string
246
+ format: date-time
247
+ - type: "null"
248
+ default: null
249
+ title: Valid
250
+ description: |-
251
+ Time range of validity for this data product.
252
+ FILENAME:
253
+ description: |-
254
+ Name of the file containing the data product.
255
+ anyOf:
256
+ - type: string
257
+ - type: "null"
258
+ default: null
259
+ ###############
260
+ INSTRUMENT:
261
+ title: Instrument
262
+ required:
263
+ - CLASS
264
+ - ID
265
+ - SITE
266
+ - TYPE
267
+ type: object
268
+ additionalProperties: false
269
+ properties:
270
+ SITE:
271
+ anyOf:
272
+ - type: "null"
273
+ - type: string
274
+ description: |-
275
+ CTA Site.
276
+ default: null
277
+ example:
278
+ - CTA-North
279
+ - CTA-South
280
+ CLASS:
281
+ anyOf:
282
+ - type: "null"
283
+ - type: string
284
+ default: null
285
+ description: |-
286
+ General class of instrument to which this data product applies.
287
+ example:
288
+ - array
289
+ - subarray
290
+ - telescope
291
+ - camera
292
+ - optics
293
+ - mirrorPanel
294
+ - photosensor
295
+ - cameraModule
296
+ - part
297
+ TYPE:
298
+ anyOf:
299
+ - type: "null"
300
+ - type: string
301
+ default: null
302
+ description: |-
303
+ The specific type of instrument in the class.
304
+ example:
305
+ - MST
306
+ - LST
307
+ - SST
308
+ SUBTYPE:
309
+ anyOf:
310
+ - type: "null"
311
+ - type: string
312
+ default: null
313
+ description: |-
314
+ Sub-type of the instrument.
315
+ example:
316
+ - NectarCam
317
+ - FlashCam
318
+ ID:
319
+ anyOf:
320
+ - type: "null"
321
+ - type: string
322
+ - type: number
323
+ default: null
324
+ description: |-
325
+ Unique ID of the specific instrument in the class.
326
+ example:
327
+ - MSTN-20
328
+ DESCRIPTION:
329
+ anyOf:
330
+ - type: string
331
+ - type: "null"
332
+ default: null
333
+ description: Instrument description
334
+ ###############
335
+ PROCESS:
336
+ title: Process
337
+ description: |-
338
+ The top-level activity to which the activity that generated this
339
+ product belongs, for example an Observation Block, and it's
340
+ associated ID.
341
+ required:
342
+ - TYPE
343
+ - ID
344
+ type: object
345
+ additionalProperties: false
346
+ properties:
347
+ TYPE:
348
+ description: |-
349
+ General type of the process.
350
+ anyOf:
351
+ - type: "null"
352
+ - type: string
353
+ default: null
354
+ enum:
355
+ - observation
356
+ - calibration
357
+ - simulation
358
+ - lab
359
+ - null
360
+ SUBTYPE:
361
+ description: |-
362
+ More specific class of the process if the class is not sufficient
363
+ to describe it.
364
+ anyOf:
365
+ - type: "null"
366
+ - type: string
367
+ default: null
368
+ ID:
369
+ description: |-
370
+ Unique identifier of the process.
371
+ anyOf:
372
+ - type: "null"
373
+ - type: string
374
+ - type: number
375
+ default: null
376
+ ###############
377
+ ACTIVITY:
378
+ title: Activity
379
+ description: |-
380
+ The specific software or task that generated this particular
381
+ data product.
382
+ required:
383
+ - ID
384
+ - NAME
385
+ - START
386
+ - END
387
+ - TYPE
388
+ type: object
389
+ additionalProperties: false
390
+ properties:
391
+ NAME:
392
+ description: |-
393
+ Name of activity that produced this data product,
394
+ e.g. the software/ script name.
395
+ anyOf:
396
+ - type: string
397
+ - type: "null"
398
+ default: null
399
+ TYPE:
400
+ description: |-
401
+ General type of the activity.
402
+ anyOf:
403
+ - type: string
404
+ - type: "null"
405
+ default: null
406
+ example:
407
+ - software
408
+ - user
409
+ ID:
410
+ description: |-
411
+ Unique identifier of the instance of this activity.
412
+ anyOf:
413
+ - type: string
414
+ - type: "null"
415
+ - type: number
416
+ default: null
417
+ SOFTWARE:
418
+ title: Software
419
+ description: |-
420
+ The software used to generate this data product.
421
+ type: object
422
+ additionalProperties: false
423
+ properties:
424
+ NAME:
425
+ description: |-
426
+ Name of the software used to generate this data product.
427
+ anyOf:
428
+ - type: string
429
+ - type: "null"
430
+ default: null
431
+ VERSION:
432
+ description: |-
433
+ Version of the software used to generate this data product.
434
+ anyOf:
435
+ - type: string
436
+ - type: "null"
437
+ default: null
438
+ required:
439
+ - NAME
440
+ - VERSION
441
+ START:
442
+ description: |-
443
+ Start time of the activity.
444
+ anyOf:
445
+ - type: string
446
+ format: date-time
447
+ - type: "null"
448
+ default: null
449
+ END:
450
+ description: |-
451
+ End time of the activity.
452
+ anyOf:
453
+ - type: string
454
+ format: date-time
455
+ - type: "null"
456
+ default: null
457
+ ###############
458
+ CONTEXT:
459
+ title: Context
460
+ description: |-
461
+ Additional context information for this data product.
462
+ type: object
463
+ additionalProperties: false
464
+ properties:
465
+ NOTES:
466
+ title: Context notes.
467
+ description: |-
468
+ Notes that provide additional context for this data product.
469
+ type: array
470
+ items:
471
+ type: object
472
+ additionalProperties: false
473
+ properties:
474
+ TITLE:
475
+ description: |-
476
+ Title of note.
477
+ anyOf:
478
+ - type: string
479
+ - type: "null"
480
+ default: null
481
+ TEXT:
482
+ description: |-
483
+ Note text.
484
+ anyOf:
485
+ - type: string
486
+ - type: "null"
487
+ default: null
488
+ CREATION_TIME:
489
+ description: |-
490
+ Creation time of document.
491
+ anyOf:
492
+ - type: string
493
+ format: date-time
494
+ - type: "null"
495
+ default: null
496
+ required:
497
+ - TEXT
498
+ DOCUMENT:
499
+ title: Context documents.
500
+ description: |-
501
+ Documents that provide additional context for this data product.
502
+ type: array
503
+ items:
504
+ type: object
505
+ additionalProperties: false
506
+ properties:
507
+ TYPE:
508
+ description: |-
509
+ Type of document.
510
+ anyOf:
511
+ - type: string
512
+ - type: "null"
513
+ default: null
514
+ TITLE:
515
+ description: |-
516
+ Title of document.
517
+ anyOf:
518
+ - type: string
519
+ - type: "null"
520
+ default: null
521
+ ID:
522
+ description: |-
523
+ Unique identifier of document.
524
+ anyOf:
525
+ - type: string
526
+ - type: "null"
527
+ - type: number
528
+ default: null
529
+ CREATION_TIME:
530
+ description: |-
531
+ Creation time of document.
532
+ anyOf:
533
+ - type: string
534
+ format: date-time
535
+ - type: "null"
536
+ default: null
537
+ URL:
538
+ description: |-
539
+ Link to document
540
+ anyOf:
541
+ - type: string
542
+ format: uri
543
+ - type: "null"
544
+ default: null
545
+ required:
546
+ - CREATION_TIME
547
+ - ID
548
+ - TITLE
549
+ - TYPE
550
+ ASSOCIATED_ELEMENTS:
551
+ title: Associated elements.
552
+ description: |-
553
+ CTA elements associated with this data product
554
+ (e.g., this data product is to be used to model
555
+ a certain camera).
556
+ type: array
557
+ items:
558
+ $ref: '#/definitions/CTA/properties/INSTRUMENT'
559
+ ASSOCIATED_DATA:
560
+ title: Associated data.
561
+ description: |-
562
+ Associated data products (e.g., this data product
563
+ has been derived using the associated data).
564
+ type: array
565
+ items:
566
+ $ref: '#/definitions/CTA/properties/PRODUCT'
@@ -45,6 +45,8 @@ class SimtelConfigWriter:
45
45
  "atmospheric_profile",
46
46
  "magnetic_field",
47
47
  "EPSG",
48
+ "mirror_panel_shape",
49
+ "mirror_panel_diameter",
48
50
  ]
49
51
 
50
52
  def __init__(
@@ -97,8 +99,8 @@ class SimtelConfigWriter:
97
99
  ----------
98
100
  config_file_path: str or Path
99
101
  Path of the file to write on.
100
- layout: LayoutArray
101
- Instance of LayoutArray referent to the array model.
102
+ layout: ArrayLayout
103
+ Instance of ArrayLayout referent to the array model.
102
104
  telescope_model: list of TelescopeModel
103
105
  List of TelescopeModel's instances as used by the ArrayModel instance.
104
106
  site_parameters: dict
@@ -155,8 +157,13 @@ class SimtelConfigWriter:
155
157
  set_focal_length_to_zero: bool
156
158
  Flag to set the focal length to zero.
157
159
  """
158
- __, __, diameter, flen, shape = mirrors.get_single_mirror_parameters(mirror_number)
159
-
160
+ (
161
+ __,
162
+ __,
163
+ mirror_panel_diameter,
164
+ focal_length,
165
+ shape_type,
166
+ ) = mirrors.get_single_mirror_parameters(mirror_number)
160
167
  with open(single_mirror_list_file, "w", encoding="utf-8") as file:
161
168
  self._write_header(file, "MIRROR LIST FILE", "#")
162
169
 
@@ -176,7 +183,9 @@ class SimtelConfigWriter:
176
183
  )
177
184
  file.write("#\n")
178
185
  file.write(
179
- f"0. 0. {diameter} {flen if not set_focal_length_to_zero else 0} {shape} 0.\n"
186
+ f"0. 0. {mirror_panel_diameter.to('cm').value} "
187
+ f"{focal_length.to('cm').value if not set_focal_length_to_zero else 0} "
188
+ f"{shape_type} 0.\n"
180
189
  )
181
190
 
182
191
  def _write_header(self, file, title, comment_char="%"):