Configuring a Case
Case Directory
Cases are configured using yaml files and by providing necessary user data in a case directory. Here is a typical directory structure:
Note
Throughout the tutorial chevrons "<>" will be used to denote placeholders entries that help explain the format. These should be omitted from the actual configuration files. For example: imaging_mode: <imaging mode>
shows there are several options for this entry. One such options would be imaging_mode: multispectral
.
case_directory
├───case_settings.yml
├───mission_parameters.yml
├───sensor
│ ├───film.spd
│ └───sensor.yml
└───target
├───parts.yml
├───materials
│ ├───aluminium.spd
│ └───sar_material.yml
└───mesh
├───paz_antenna.ply
├───paz_antenna_rod.ply
├───paz_body.ply
├───paz_sar_array.ply
└───paz_solar_panel.ply
The layout and naming convensions are not enforced however all files must be in the same parent directory (case_directory
in the example). When running the code it must be done from the root of the case directory - in this case from within case_directory
.
File Types
HySim recognises several types of configuration and data files:
- YAML files are used to configure user inputs. These are edited manually between each case. Yaml files must start with
---
. HySim defines content through<key>: <value>
pairs. These pairs are nestable through indentation. For detailed information on YAML format see here. - SPD files contain a spectral reflectance distribution consisting of a single measurement and wavelengths per line. The file must be tab delimited and formatted in utf-8. In the case of spd files used for wide multispectral (not hyperspectral) film bands, there can be multiple columns of data for each wavelength, each representing as band. For all other spectra only a single column is needed.
- PLY files are triangulated mesh formats containing a single component. Each component has a single material assigned to it. See section on preparing a target mesh for details.
Configuration Files
There are four main configuration files required to run a case. Each file contains a header with the entry file_type : <config type>
to differentiate between them:
- Case Settings - Choose renderer settings, logger settings and output formats. Header:
file_type: case_config
. - Mission Parameters - Choose orbit position and attitude of target and chaser and the epoch. Header:
file_type: mission_config
. - Sensor Parameters - Choose the Multispectral/Hyperspectral camera and film parameters. Header:
file_type: sensor_config
. - Parts - List the components that make up the target model and assign materials to each. Header:
file_type: parts_config
.
There is also an additional optional configuration file for assigning user defined materials (file_type: material_config
). This can be supplied alongside a .spd file containing the spectral reflectance for the material. The format directly corresponds to the desired Mitsuba BSDF dictionary format.
Case Settings
The case settings file requires the following entries:
The mitsuba variant chosen should be a spectral type. The full list can be found here.Note
Currently the only supported variant in the pip installed version of the program is scalar_spectral
. To use GPU variants you need to compile mitsuba from source.
path
. The max depth refers to the longest path to be rendered (number of reflections). max_depth: -1
sets infinite bounces for the best result at expense of computation time.
The log entry allows the user to save the console logs to a file. Set save_case_log
to True
or False
. If true it will be saved to a log file using the file name given.
Warning
Log file writing is yet to be implemented.
Format | Description |
---|---|
exr |
Exports to OpenEXR Format |
png |
Exports each band to a png file |
Mission Parameters
Mission Parameter files must contain the following entries. The epoch for the image must be provided in the format above in utc time:
The epoch is used to calculate the position of the Sun relative to the scene and the position of the spacecraft when using TLE. The orbit position and attitude of the target are given in the following format: The format providing the target's orbit is selected usingposition_frame
. The currently supported formats are:
Format | Description |
---|---|
tle |
Two Line Element Set |
kep |
Keplerian Elements |
eci |
Coordinates in Earth Centered Inertial |
Here are examples for defining the orbit of the ISS:
Enter Two Line Element sets as a comma seperated list:
List of keplerian elements: [a, e, i, raan, argp, M]
Parameter | Description |
---|---|
a |
Semi-major axis in km |
e |
Eccentricity |
i |
Inclination in radians |
raan |
Right ascension of the ascending node in radians |
argp |
Argument of periapsis in radians |
M |
Mean Anomaly at epoch in radians |
Estimated ISS Elements at 12/22/2022 14:15:53 utc
:
Warning
It can be difficult to line up keplerian elements or state vectors and TLE due to the errors in conversions and the propagation method. It is recommended you choose either Vectors and Keplerian or only TLE.
Warning
If the orbit (or velocities) defined are too large then there may be problems with vertex positions defined in the mesh. This could be due to limitations in floating point precision and not an issue with the mesh.
The attitude of the target is given as Euler angles with respect to the LVLH frame in the following format: attitude: [<x-axis>, <y-axis>, <z-axis>]
. Each rotation is in radians. The chaser uses the same inputs as the target:
For the chaser there is an option to set attitude: lookat
which automatically determines the orientation of the spacecraft to look directly at the target.
Sensor
The Sensor parameters are contained in the Sensor Config file. All sensors are defined as a Mitsuba perspecive camera which assumes an infinitely small aperture. The following parameters can be provided to define the camera:
The hyperspectral film used in the camera is defined seperately. The resolution of the film is defined by the film
entry (note that the field of view relates to the same axis as film width along the x axis):
There are two imaging modes available: Hyperspectral
and Multispectral
:
Hyperspectral
mode creates many narrow bands based on a single sensitivity spectrum.Multispectral
mode creates a single wide band per spectrum (passed to the program as a column of data).
Choosing these modes is done with the following entries:
Here are examples of the spectrum file data for each imaging mode:
Using the data in the spd file, 9 narrow bands will be created for each wavelength interval of 1 nm. The sensitivity of each band will be linear between each sensitivity interval. For example band 0 will have a wavelength range from 400-401 nm and a film sensitivity of 0.86-0.01.
400 0.86 0.17 0.19 0.11 0.82
401 0.91 0.26 0.17 0.02 0.71
402 0.71 0.45 0.15 0.04 0.53
403 0.52 0.53 0.23 0.06 0.42
404 0.24 0.72 0.25 0.07 0.35
405 0.10 0.80 0.17 0.08 0.30
406 0.06 0.75 0.26 0.06 0.37
407 0.05 0.68 0.36 0.15 0.35
408 0.04 0.59 0.55 0.12 0.18
409 0.02 0.34 0.73 0.13 0.03
410 0.01 0.22 0.81 0.14 0.01
Parts
The parts file contains the components
entry where the components that make up the target are listed:
components:
<part1 name>:
file: <path/mesh1.ply>
database_material: <material name>
<part2 name>:
file: <path/mesh2.ply>
user_material: <material name>
Format | Description |
---|---|
database_material |
Chooses a material from the database. |
user_material |
Parses entries in the optional materials.yml file for the name provided |
Materials File
User defined materials are listed in the materials configuration. The format of each material relates directly to the a Mitsuba BSDF. The name of each material must match those assigned to a mesh component in the parts_config
file. In the example below a material representing aluminium with diffuse (lambertian scattering) reflectance properties. The path to the reflectance data file from the root directory should be specified in the filename
entry. Here is an example defining defuse aluminium with a spectrum file supplied by the user:
---
# ========================================================================
# User Material Configuration File
# ========================================================================
# File type: specifies the type of configuration file to be interpreted by
# the program.
file_type: material_config
# Material configuration specifies a user BSDF in mitsubas dict format.
# best to refer to mitsubas documentation on BSDFs.
materials:
# First indent: material name
diffuse_aluminium:
# Second indent: material type and its properties
type: diffuse
reflectance:
type: spectrum
# User specifies spectrum file.
filename: target/materials/aluminium.spd