danieljfarrell / pvtrace

Optical ray tracing for luminescent materials and spectral converter photovoltaic devices
Other
98 stars 94 forks source link

Command line interface (CLI) #40

Closed danieljfarrell closed 3 years ago

danieljfarrell commented 4 years ago

Feature roadmap

The CLI's role is to kick off and modify simulation parameters using a scene described in a YAML file.

pvtrace-cli --scene pvtrace-scene.yml --rays 10000 --processors 16

The main bulk of the CLI is in parsing the YAML file to construct Python objects. The CLI also handles parallelising the execution of the code multiple cores. Additional arguments will probably be needed such as --seed for debugging.

Output data should also be exported and arguments might be needed for this too.

Scene

The pvtrace scene

world = Node(
    name="world (air)",
    geometry=Sphere(
        radius=50.0,
        material=Material(refractive_index=1.0),
    )
)

box = Node(
    name="sphere (glass)",
    geometry=Box(
        (10.0, 10.0, 1.0),
        material=Material(refractive_index=1.5),
    ),
    parent=world
)

can be described by YAML file

version: "1.0"

nodes:
  world:
    sphere:
      radius:50.0
      material:
        refractive-index:1.0

  sphere-glass:
    parent: "world"
    box:
      size: [10.0, 10.0, 10.0]
      material:
        refractive-index:1.5

Parallelisation

The parallelisation should not be implement in the CLI it should use parallelisation features added to pvtrace. For example, it probably makes sense to a method to Scene object or a new Simulation object which is capable of running on multiple processes. Details can can be defined later and in a separate issue number. See https://github.com/danieljfarrell/pvtrace/issues/41

danieljfarrell commented 3 years ago

This is included in the CLI development branch. Will first appear in pvtrace 2.2 when it is released