-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'vis_updates' into redesing_system
- Loading branch information
Showing
7 changed files
with
352 additions
and
149 deletions.
There are no files selected for viewing
149 changes: 0 additions & 149 deletions
149
containers/cleanair/gpjax_models/gpjax_models/models/vis.py
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
containers/cleanair/gpjax_models/gpjax_models/parser/visualization/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Parser for visualization.""" | ||
|
||
from .main import app | ||
|
||
__all__ = ["app"] |
10 changes: 10 additions & 0 deletions
10
containers/cleanair/gpjax_models/gpjax_models/parser/visualization/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Parser for model vis.""" | ||
|
||
import typer | ||
from . import vis | ||
|
||
app = typer.Typer(help="Jax model visualization") | ||
app.add_typer(vis.app, name="vis") | ||
|
||
if __name__ == "__main__": | ||
app() |
115 changes: 115 additions & 0 deletions
115
containers/cleanair/gpjax_models/gpjax_models/parser/visualization/vis.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import typer | ||
from pathlib import Path | ||
from ...results.vis import ( | ||
Visualization, | ||
) | ||
|
||
app = typer.Typer(help="Visualazation for model results") | ||
app = typer.Typer() | ||
|
||
|
||
def run_visualization_process(input_dir: Path, data_type: str): | ||
""" | ||
Run the entire visualization process (loading, preparing, and visualizing). | ||
Args: | ||
input_dir (Path): Path to the input data directory. | ||
data_type (str): Type of data to visualize, e.g., 'with_satellite', 'with_traffic', etc. | ||
""" | ||
try: | ||
typer.echo( | ||
f"Initializing visualization for {data_type} with data from {input_dir}" | ||
) | ||
|
||
# Initialize the visualization object | ||
vis = Visualization(input_dir, data_type) | ||
|
||
# Load data and results | ||
vis.load_data() | ||
vis.load_results() | ||
|
||
# Prepare data | ||
vis.prepare_data() | ||
|
||
# Call the appropriate visualization method based on data_type | ||
if data_type == "with_traffic": | ||
vis.visualize_with_traffic_data() | ||
elif data_type == "with_satellite": | ||
vis.visualize_with_sat_data() | ||
elif data_type == "test_data": | ||
vis.visualize_with_test_data() | ||
elif data_type == "default": | ||
vis.visualize_default() | ||
else: | ||
raise ValueError(f"Unsupported data_type: {data_type}") | ||
|
||
except AttributeError as e: | ||
typer.echo( | ||
f"AttributeError: {e}. Check if the correct visualization method exists." | ||
) | ||
raise | ||
except FileNotFoundError as e: | ||
typer.echo(f"FileNotFoundError: {e}. Check if files exist in {input_dir}") | ||
raise | ||
except ValueError as ve: | ||
typer.echo(f"Error during visualization process: {ve}") | ||
raise | ||
except Exception as e: | ||
typer.echo(f"Error visualizing the results: {e}") | ||
raise | ||
|
||
|
||
@app.command() | ||
def satellite( | ||
input_dir: Path = typer.Option( | ||
..., help="Input directory containing the data files" | ||
), | ||
): | ||
""" | ||
Visualize satellite data. | ||
""" | ||
typer.echo(f"Visualizing satellite data from {input_dir}") | ||
run_visualization_process(input_dir, "with_satellite") | ||
|
||
|
||
@app.command() | ||
def traffic( | ||
input_dir: Path = typer.Option( | ||
..., help="Input directory containing the data files" | ||
), | ||
): | ||
""" | ||
Visualize traffic data. | ||
""" | ||
typer.echo(f"Visualizing traffic data from {input_dir}") | ||
run_visualization_process(input_dir, "with_traffic") | ||
|
||
|
||
@app.command() | ||
def test_data( | ||
input_dir: Path = typer.Option( | ||
..., help="Input directory containing the data files" | ||
), | ||
): | ||
""" | ||
Visualize test data. | ||
""" | ||
typer.echo(f"Visualizing test data from {input_dir}") | ||
run_visualization_process(input_dir, "test_data") | ||
|
||
|
||
@app.command() | ||
def default( | ||
input_dir: Path = typer.Option( | ||
..., help="Input directory containing the data files" | ||
), | ||
): | ||
""" | ||
Run default visualization. | ||
""" | ||
typer.echo(f"Running default visualization from {input_dir}") | ||
run_visualization_process(input_dir, "default") | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
Empty file.
Empty file.
Oops, something went wrong.