Skip to content

Commit

Permalink
ft: time configuration can now be instantiated by explicit time windows
Browse files Browse the repository at this point in the history
docs: completed Experiment Configuration section,
  • Loading branch information
pabloitu committed Sep 26, 2024
1 parent ef32c94 commit 3f564ef
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 32 deletions.
4 changes: 0 additions & 4 deletions docs/guide/config.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _evaluation_config:

Evaluations Definition
======================

Expand Down
269 changes: 269 additions & 0 deletions docs/guide/experiment_config.rst

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/guide/model_config.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _model_config:

Models Configuration
====================

Expand Down
4 changes: 3 additions & 1 deletion docs/guide/postprocess_config.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Post-process Options
.. _postprocess:

Post-Process Options
====================

TBI
4 changes: 0 additions & 4 deletions docs/guide/region_config.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/guide/time_config.rst

This file was deleted.

13 changes: 5 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
===============================
floatCSEP: Floating Experiments
===============================

*Testing earthquake forecasts made simple.*

.. image:: https://img.shields.io/badge/GitHub-Repository-blue?logo=github
Expand Down Expand Up @@ -76,9 +75,9 @@ The `Collaboratory for the Study of Earthquake Predictability <https://cseptesti
Goals
-----

* Set up a testing experiment for your forecasts using authoritative data sources/benchmarks.
* Encapsulate the complete experiment's definition and rules in a couple of lines.
* Reproduce, reuse, and share forecasting experiments.
* Set up a testing experiment for your forecasts using authoritative data sources/benchmarks.
* Encapsulate the complete experiment's definition and rules in a couple of lines.
* Reproduce, reuse, and share forecasting experiments.

Running
-------
Expand Down Expand Up @@ -165,11 +164,9 @@ Collaborators
:hidden:
:caption: Defining an Experiment

guide/config.rst
guide/time_config.rst
guide/region_config.rst
guide/experiment_config.rst
guide/model_config.rst
guide/tests_config.rst
guide/evaluation_config.rst
guide/postprocess_config.rst

.. toctree::
Expand Down
27 changes: 16 additions & 11 deletions floatcsep/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,16 @@ def read_time_cfg(time_config, **kwargs):
if "offset" in time_config.keys():
time_config["offset"] = parse_timedelta_string(time_config["offset"])

if experiment_class == "ti":
time_config["timewindows"] = timewindows_ti(**time_config)
return time_config
elif experiment_class == "td":
time_config["timewindows"] = timewindows_td(**time_config)
return time_config
if not time_config.get("timewindows"):
if experiment_class == "ti":
time_config["timewindows"] = timewindows_ti(**time_config)
elif experiment_class == "td":
time_config["timewindows"] = timewindows_td(**time_config)
else:
time_config["start_date"] = time_config["timewindows"][0][0]
time_config["end_date"] = time_config["timewindows"][-1][-1]

return time_config


def read_region_cfg(region_config, **kwargs):
Expand Down Expand Up @@ -340,7 +344,7 @@ def timewindows_td(
Creates the testing intervals for a time-dependent experiment.
Note:
The following arg combinations are possible:
The following are combinations are possible:
- (start_date, end_date, timeintervals)
- (start_date, end_date, timehorizon)
- (start_date, timeintervals, timehorizon)
Expand Down Expand Up @@ -391,10 +395,11 @@ def timewindows_td(
except ValueError as e_:
raise ValueError(
"The following experiment parameters combinations are possible:\n"
" (start_date, end_date)\n"
" (start_date, end_date, intervals)\n"
" (start_date, end_date, timewindow)\n"
" (start_date, intervals, timewindow)\n"
" (start_date, end_date, timeintervals)\n"
" (start_date, end_date, timehorizon)\n"
" (start_date, timeintervals, timehorizon)\n"
" (start_date, end_date, timehorizon, timeoffset)\n"
" (start_date, timeinvervals, timehorizon, timeoffset)\n"
)

# if growth == 'incremental':
Expand Down

0 comments on commit 3f564ef

Please sign in to comment.