Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def render( self, base_path:str ) -> None:
super().render(base_path,None,renderLeaves=False)
self.leaf_repository.render(base_path)

def patchTemplateInfo( self, patches:list[str], targets:str, prefix:str, save:bool = False ):
def patchTemplateInfo( self, patches:List[str], targets:str, prefix:str, save:bool = False ):
"""
Applies template patches to specific leaf components based on the given target criteria.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, location:str, template_info: TemplateInfo) -> None:
if not os.path.exists( location ):
warnings.warn(f"{location} does not contain any files")

def load(self,repository:Repository, parent_ids:list[str]) -> None:
def load(self,repository:Repository, parent_ids:List[str]) -> None:
"""
Load local leaf components (in the filesystem) into the repository.
It iterates over subdirectories in the `self.location`, treating each as a separate leaf component, and uses the `ViewFactory` to create a view for it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ def castNodeTemplateInfo(cls,v):


class DashboardSchema(BaseModel):
dashboard_metadata:Optional[Union[dict[str,str],TemplateInfo]] = TemplateInfo(data={})
dashboard_metadata:Optional[Union[Dict[str,str],TemplateInfo]] = TemplateInfo(data={})
component_map: Union[ComponentMap,Dict]
components: Dict[str,Dict[str, Union[dict[str,str],TemplateInfo]]]
components: Dict[str,Dict[str, Union[Dict[str,str],TemplateInfo]]]
views : Optional[Dict[str,Union[Dict,str]]] = None
repositories : Optional[Dict[str,Union[dict[str,str],TemplateInfo]]] = None
repositories : Optional[Dict[str,Union[Dict[str,str],TemplateInfo]]] = None
template_defaults: Optional[TemplateDefaults] = TemplateDefaults()

@model_validator(mode="after")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class PlotAxis(BaseModel):
parameter: str
label:Optional[str] = None
filter:Optional[Union[str,list[str],dict[str,str],list[dict[str,str]]]] = []
filter:Optional[Union[str,List[str],Dict[str,str],List[Dict[str,str]]]] = []

@field_validator("filter",mode="after")
@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
ybar,
legend style={at={(0.5,-0.1)},anchor=north}
]
{% for var,name in zip(variables,names) %}
{% for var in variables %}
\addplot table [x expr=\coordindex, y={{ var }}] {{'{#2}'}} ;
\addlegendentry{ {{name}} }
\addlegendentry{ {{var}} }
{% endfor %}

\end{axis}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
xticklabels from table={{'{#2}'}}{{'{'}}{{xaxis.parameter}}{{'}'}},
cycle list name=color list, legend style={at={(0.5,-0.1)},anchor=north}
]
{% for var,name in zip(variables,names) %}
{% for var in variables %}
{% if var not in fill_lines %}
\addplot table [x expr=\coordindex, y={{ var }}] {{'{#2}'}} ;
\addlegendentry{ {{name}} }
\addlegendentry{ {{var}} }
{% endif %}
{% endfor %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
{% if i > 1 %}
\resetstackedplots
{% endif %}
{% for var,name,color in zip(variables,names, colors) %}
{% for var,color in zip(variables, colors) %}
\addplot+[ybar, bar width=0.2,point meta=y,draw=black,fill={{color}}{% if i > 1 %}, forget plot{% endif %} ] table [x expr=\coordindex+0.25*{{i}}, y={{ var }}] {\data{{i | inttouniquestr}}} ;
{% if i == 1%}
\addlegendentry{ {{name}} }
\addlegendentry{ {{var}} }
{% endif %}
{% endfor %}
{% endfor %}
Expand Down
2 changes: 2 additions & 0 deletions src/feelpp/benchmarking/json_report/figures/tikzFigures.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def createMultiindexFigure(self, df, **args):
xaxis = self.config.xaxis,
yaxis = self.config.yaxis,
caption = self.config.title,
variables = df.columns.to_list(),
secondary_axis = self.config.secondary_axis,
anim_dimension_values = [str(dim) for dim in anim_dim_values],
csv_filenames = [f"{dim}.csv" for dim in anim_dim_values],
Expand All @@ -64,6 +65,7 @@ def createSimpleFigure(self, df, **args):
xaxis = self.config.xaxis,
yaxis = self.config.yaxis,
caption = self.config.title,
variables = df.columns.to_list(),
csv_filenames = [f"{self.config.title}.csv"],
**args
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd
import numpy as np


class TransformationStrategy:
Expand Down Expand Up @@ -153,8 +154,26 @@ def calculate(self,df):
return pd.DataFrame(columns=["optimal","half-optimal"])

if isinstance(pivot.index, pd.MultiIndex):
pivot = pivot.xs(pivot.index.get_level_values(self.dimensions["xaxis"].parameter).min(),level=self.dimensions["xaxis"].parameter,axis=0) / pivot
pivot["optimal"] = pivot.index.get_level_values(self.dimensions["xaxis"].parameter) / pivot.index.get_level_values(self.dimensions["xaxis"].parameter).min()
lvl = self.dimensions["xaxis"].parameter
outer = [n for n in pivot.index.names if n != lvl]
group_level = outer[0] if len(outer) == 1 else outer

results = []

for key, subdf in pivot.groupby(level=group_level):
vals = subdf.index.get_level_values(lvl)
ref = np.nanmin(vals)

base = subdf.xs(ref, level=lvl, axis=0)
speed = base / subdf

speed["optimal"] = vals / ref
speed["half-optimal"] = (speed["optimal"] - 1) / 2 + 1

results.append(speed)

pivot = pd.concat(results)

else:
pivot = pivot.loc[pivot.index.min(),:] / pivot
pivot["optimal"] = pivot.index / pivot.index.min()
Expand Down
2 changes: 1 addition & 1 deletion src/feelpp/benchmarking/json_report/schemas/jsonReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def coerceListInput( cls, values ):
else:
raise TypeError(f"Expected dict or list at root, got {type(values)}")

def flattenContent(self, contents = None) -> list[Node]:
def flattenContent(self, contents = None) -> List[Node]:
flattened = []
if contents is None:
contents = self.contents
Expand Down