==================================== Solving the Emitter-Observer Problem ==================================== Calculating light signals between two curves requires * curve data, * spacetime metric. In the :doc:`previous ` section, curves were either loaded from H5-files or calculated with information stored in a configuration dictionary. The spacetime metric was already provided in the latter case. In the former case, a configuration dictionary containing information on the desired spacetime metric needs to be created, either directly in Python or saved in a `TOML document `_. Refer to the config dictionary :ref:`subsection ` for more information. An example TOML-file looks like this, if curves were not calculated with *GREOPy*: .. code-block:: toml [Metric] name = 'Schwarzschild' params.multipole_moments = [0] # no central mass example Let ``emission_curve_data`` and ``receiver_curve_data`` be the DataFrames containing all the data on the emitter's and receiver's curve, respectively. The ``eop_solver`` function calculates a light signal for each step along the emission curve. If not every step requires a light signal, the number of emission events can be reduced by declaring ``start``, ``stop`` and ``step_size`` when counting through the rows: .. code-block:: python emission_curve_reduced = emission_curve_data[start:stop:step_size] The light signals are then calculated via .. code-block:: python from greopy.emitter_observer_problem import eop_solver light_rays = eop_solver( config, emission_curve_reduced, receiver_curve_data, ) providing the curves' and config data. The resulting ``light_rays`` lists indexed DataFrames. Each DataFrame in turn contains a light signal curve that connects the emitter and receiver curve at one emission and reception event. Optionally save the light rays for later data analysis: .. code-block:: python import pandas for light_ray in light_rays: light_ray_index, light_ray_solution = light_ray light_ray_solution.to_hdf( 'light_file', key="light_ray_" + f"{light_ray_index}".rjust(3, '0'), mode="a", ) This saves all light ray datasets in an H5-file named ``light_file``, each with a different ``key: light_ray_*``, where * indexes the light ray according to their respective emission event along the emitter curve. In this case a maximum number of 1000 light rays was assumed, so the index always consists of three digits, e.g. ``003`` or ``010``, to preserve the light ray sequence within the H5-file. The data can be loaded again via the ``load_dataset`` function: .. code-block:: python from greopy.common import load_dataset light_rays_loaded = load_dataset('path/to/light_file') Note that the variables ``light_rays`` and ``light_rays_loaded`` slightly differ in form: * ``light_rays`` contains a ``list``, each entry a tuple ``(index, DataFrame)``, * ``light_rays_loaded`` constains a ``Generator``, whose values are ``DataFrame`` objects. .. todo:: Add more parameters to eop_solver function