Skip to content

Commit

Permalink
Further plotting advances
Browse files Browse the repository at this point in the history
  • Loading branch information
daquintero committed Sep 1, 2024
1 parent 8fdcf36 commit 44bf861
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
18 changes: 9 additions & 9 deletions piel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import os
import pathlib

# Libraries - Do not move from here
import piel.develop as develop
import piel.materials as materials # NOQA: F401
import piel.models as models # NOQA: F401
import piel.types as types # NOQA: F401
import piel.visual as visual # NOQA: F401
import piel.tools as tools # NOQA: F401
import piel.integration as integration # NOQA: F401
import piel.units as units # NOQA: F401
# Libraries - Do not change the order
from . import develop as develop
from . import materials as materials # NOQA: F401
from . import models as models # NOQA: F401
from . import types as types # NOQA: F401
from . import visual as visual # NOQA: F401
from . import tools as tools # NOQA: F401
from . import integration as integration # NOQA: F401
from . import units as units # NOQA: F401

# Functions
from piel.file_system import *
Expand Down
20 changes: 14 additions & 6 deletions piel/experimental/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
return_path,
write_model_to_json,
)
from .text import write_schema_markdown, write_experiment_top_markdown
from .text import write_experiment_top_markdown
import logging

logger = logging.getLogger(__name__)
Expand All @@ -21,6 +21,7 @@ def construct_experiment_directories(
experiment: Experiment,
parent_directory: PathTypes,
construct_directory: bool = True,
write_schema_markdown: bool = False,
) -> PathTypes:
"""
This function constructs the directories of the experiment configuration. It iterates through the experiment
Expand All @@ -42,7 +43,7 @@ def construct_experiment_directories(
The data files are manually generated from the corresponding measurements specified in the instance.json file.
These will be added after wards from this directory structure creation.
This schema is used to generate a README file for the experiment configuration. This README file should contain
This schema is used to generate a README file for the experiment configuration if `write_markdown_schema` is true. This README file should contain
all the information about the experiment configuration. This includes the experiment instances and their
corresponding configurations.
Expand All @@ -54,6 +55,9 @@ def construct_experiment_directories(
parent_directory : PathTypes
The parent directory to create the experiment directory in.
write_markdown_schema : bool
Writes the json schema into markdown if true. Defaults to false.
Returns
-------
PathTypes
Expand Down Expand Up @@ -89,6 +93,7 @@ def construct_experiment_directories(
# Create the experiment README.md file
experiment_markdown_path = experiment_directory / "README.md"
setup_experiment_markdown_path = experiment_directory / "SETUP.md"

write_experiment_top_markdown(
experiment, experiment_directory, experiment_markdown_path
)
Expand All @@ -101,9 +106,10 @@ def construct_experiment_directories(
experiment_markdown_path,
)

# Append schema to markdown
write_schema_markdown(experiment_json_path, experiment_markdown_path)
write_schema_markdown(experiment_json_path, setup_experiment_markdown_path)
if write_schema_markdown:
# Append schema to markdown
write_schema_markdown(experiment_json_path, experiment_markdown_path)
write_schema_markdown(experiment_json_path, setup_experiment_markdown_path)

# Create the experiment instances
for index, experiment_instance in enumerate(experiment.experiment_instances):
Expand All @@ -115,7 +121,9 @@ def construct_experiment_directories(
instance_json_path = experiment_instance_directory / "instance.json"
instance_markdown_path = experiment_instance_directory / "README.md"
write_model_to_json(experiment_instance, instance_json_path)
write_schema_markdown(instance_json_path, instance_markdown_path)

if write_schema_markdown:
write_schema_markdown(instance_json_path, instance_markdown_path)

logger.debug(
"construct_experiment_directories: Finished creating experiment instances at %s",
Expand Down
10 changes: 9 additions & 1 deletion piel/experimental/measurements/data/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def extract_data_from_measurement_collection(
measurement_data_i = measurement_data_type()
else:
raise e
assert isinstance(measurement_data_i, measurement_data_type)

try:
logger.error(
f"Constructed {measurement_data_i} is not of the target measurement data type {measurement_data_type}"
)
assert isinstance(measurement_data_i, measurement_data_type)
except AssertionError as e:
raise e

measurement_data_collection.append(measurement_data_i)
i += 1

Expand Down
4 changes: 3 additions & 1 deletion piel/experimental/measurements/data/oscilloscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
def extract_oscilloscope_data_from_measurement(
measurement: OscilloscopeMeasurement,
) -> OscilloscopeMeasurementData:
pass
raise NotImplementedError(
"This extraction method has not been generically implemented."
)
4 changes: 3 additions & 1 deletion piel/experimental/measurements/data/propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
def extract_propagation_delay_data_from_measurement(
measurement: PropagationDelayMeasurement,
) -> PropagationDelayMeasurementData:
pass
raise NotImplementedError(
"This generic data extraction method has not been generically implemented."
)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ dev = [
"sphinx-rtd-theme",
"sphinx-version-warning",
"sphinxcontrib-pdfembed @ git+https://github.com/SuperKogito/sphinxcontrib-pdfembed.git",
"tabulate",
"tox",
"watchdog"
]
Expand Down

0 comments on commit 44bf861

Please sign in to comment.