Note
Click here to download the full example code
Overview of the MockCurvesXRange for load case Dummy¶
from __future__ import annotations
from vimseo import EXAMPLE_RUNS_DIR
from vimseo.api import create_model
from vimseo.core.model_settings import IntegratedModelSettings
First, let's instantiate the model for a given load case:
model_name = "MockCurvesXRange"
load_case = "Dummy"
model = create_model(
model_name,
load_case,
check_subprocess=True,
model_options=IntegratedModelSettings(
directory_archive_root=EXAMPLE_RUNS_DIR / "archive/model_gallery",
directory_scratch_root=EXAMPLE_RUNS_DIR / "scratch/model_gallery",
cache_file_path=EXAMPLE_RUNS_DIR
/ f"caches/model_gallery/{model_name}_{load_case}_cache.hdf",
),
)
The model description can be accessed like this:
print(model.description)
Out:
Model MockCurvesXRange:
Load case:
Load case Dummy: A dummy load case.
Default values:
Default geometrical variables:
x_left = [-0.5]
x_right = [0.5]
y_max = [1.0]
Model inputs: x_left, x_right, y_max
Model outputs: cpu_time, date, description, directory_archive_job, directory_archive_root, directory_scratch_job, directory_scratch_root, error_code, job_name, load_case, machine, model, n_cpus, persistent_result_files, user, vims_git_version, x_history, x_left, x_right, y_history
An illustration of the load case:
model.show_image()
The model is executed with its default input values:
model.execute()
Out:
C:\Users\sebastien.bocquet\Dev\vd017\src\vimseo\utilities\curves_generator.py:44: ComplexWarning:
Casting complex values to real discards the imaginary part
{'x_left': array([-0.5]), 'x_right': array([0.5]), 'y_max': array([1.]), 'x_history': array([-0.5 , -0.48989899, -0.47979798, -0.46969697, -0.45959596,
-0.44949495, -0.43939394, -0.42929293, -0.41919192, -0.40909091,
-0.3989899 , -0.38888889, -0.37878788, -0.36868687, -0.35858586,
-0.34848485, -0.33838384, -0.32828283, -0.31818182, -0.30808081,
-0.2979798 , -0.28787879, -0.27777778, -0.26767677, -0.25757576,
-0.24747475, -0.23737374, -0.22727273, -0.21717172, -0.20707071,
-0.1969697 , -0.18686869, -0.17676768, -0.16666667, -0.15656566,
-0.14646465, -0.13636364, -0.12626263, -0.11616162, -0.10606061,
-0.0959596 , -0.08585859, -0.07575758, -0.06565657, -0.05555556,
-0.04545455, -0.03535354, -0.02525253, -0.01515152, -0.00505051,
0.00505051, 0.01515152, 0.02525253, 0.03535354, 0.04545455,
0.05555556, 0.06565657, 0.07575758, 0.08585859, 0.0959596 ,
0.10606061, 0.11616162, 0.12626263, 0.13636364, 0.14646465,
0.15656566, 0.16666667, 0.17676768, 0.18686869, 0.1969697 ,
0.20707071, 0.21717172, 0.22727273, 0.23737374, 0.24747475,
0.25757576, 0.26767677, 0.27777778, 0.28787879, 0.2979798 ,
0.30808081, 0.31818182, 0.32828283, 0.33838384, 0.34848485,
0.35858586, 0.36868687, 0.37878788, 0.38888889, 0.3989899 ,
0.40909091, 0.41919192, 0.42929293, 0.43939394, 0.44949495,
0.45959596, 0.46969697, 0.47979798, 0.48989899, 0.5 ]), 'y_history': array([9.55791851e-01, 9.19186627e-01, 8.82974933e-01, 8.47200160e-01,
8.11902883e-01, 7.77120954e-01, 7.42889593e-01, 7.09241488e-01,
6.76206889e-01, 6.43813710e-01, 6.12087625e-01, 5.81052166e-01,
5.50728821e-01, 5.21137135e-01, 4.92294800e-01, 4.64217752e-01,
4.36920263e-01, 4.10415029e-01, 3.84713263e-01, 3.59824773e-01,
3.35758051e-01, 3.12520346e-01, 2.90117745e-01, 2.68555243e-01,
2.47836811e-01, 2.27965464e-01, 2.08943321e-01, 1.90771660e-01,
1.73450975e-01, 1.56981020e-01, 1.41360853e-01, 1.26588877e-01,
1.12662868e-01, 9.95800040e-02, 8.73368837e-02, 7.59295379e-02,
6.53534323e-02, 5.56034604e-02, 4.66739226e-02, 3.85584909e-02,
3.12501531e-02, 2.47411293e-02, 1.90227531e-02, 1.40852965e-02,
9.91771375e-03, 6.50724722e-03, 3.83879098e-03, 1.89376380e-03,
6.47803812e-04, 6.44894796e-05, 6.78082517e-05, 6.81141236e-04,
1.99122107e-03, 4.03634342e-03, 6.84212324e-03, 1.04280964e-02,
1.48101431e-02, 2.00016715e-02, 2.60142864e-02, 3.28582014e-02,
4.05425073e-02, 4.90753531e-02, 5.84640702e-02, 6.87152558e-02,
7.98348299e-02, 9.18280688e-02, 1.04699623e-01, 1.18453522e-01,
1.33093166e-01, 1.48621309e-01, 1.65040035e-01, 1.82350724e-01,
2.00554013e-01, 2.19649750e-01, 2.39636942e-01, 2.60513697e-01,
2.82277166e-01, 3.04923470e-01, 3.28447632e-01, 3.52843501e-01,
3.78103668e-01, 4.04219386e-01, 4.31180478e-01, 4.58975249e-01,
4.87590385e-01, 5.17010861e-01, 5.47219839e-01, 5.78198558e-01,
6.09926238e-01, 6.42379964e-01, 6.75534582e-01, 7.09362586e-01,
7.43834009e-01, 7.78916310e-01, 8.14574266e-01, 8.50769859e-01,
8.87462170e-01, 9.24607273e-01, 9.62158129e-01, 1.00006449e+00]), <MetaDataNames.error_code: 'error_code'>: array([0]), 'model': array(['MockCurvesXRange'], dtype='<U16'), 'load_case': array(['Dummy'], dtype='<U5'), 'description': array([''], dtype='<U1'), 'job_name': array([''], dtype='<U1'), 'persistent_result_files': array([''], dtype='<U1'), 'n_cpus': array([1]), 'date': array(['2026-10-28 09:43:55.674782'], dtype='<U26'), 'cpu_time': array([0.74236917]), 'user': array(['sebastien.bocquet'], dtype='<U17'), 'machine': array(['PCBM20250036'], dtype='<U12'), 'vims_git_version': array(['5ba602a7e3571a2fc5a0a3604673c7e5410711b0'], dtype='<U40'), 'directory_archive_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\archive\\model_gallery'],
dtype='<U92'), 'directory_archive_job': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\archive\\model_gallery\\MockCurvesXRange\\Dummy\\2'],
dtype='<U117'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\model_gallery'],
dtype='<U92'), 'directory_scratch_job': array([''], dtype='<U1')}
And the results are visualised with the pre-defined plots:
figures = model.plot_results(show=True)
Out:
{'text/html': '<div> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG"></script><script type="text/javascript">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}</script> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: \'local\'};</script>\n <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.35.0.min.js"></script> <div id="49114772-4a88-493c-8a92-7f5c3327fad9" class="plotly-graph-div" style="height:525px; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("49114772-4a88-493c-8a92-7f5c3327fad9")) { Plotly.newPlot( "49114772-4a88-493c-8a92-7f5c3327fad9", [{"line":{"color":"blue","dash":"solid"},"marker":{"color":"blue"},"mode":"lines","name":"y_history","x":[-0.5,-0.4898989898989899,-0.4797979797979798,-0.4696969696969697,-0.4595959595959596,-0.4494949494949495,-0.4393939393939394,-0.4292929292929293,-0.41919191919191917,-0.40909090909090906,-0.398989898989899,-0.3888888888888889,-0.3787878787878788,-0.3686868686868687,-0.35858585858585856,-0.3484848484848485,-0.33838383838383834,-0.3282828282828283,-0.3181818181818182,-0.30808080808080807,-0.29797979797979796,-0.28787878787878785,-0.2777777777777778,-0.2676767676767676,-0.25757575757575757,-0.24747474747474746,-0.23737373737373735,-0.22727272727272724,-0.21717171717171713,-0.20707070707070707,-0.19696969696969696,-0.18686868686868685,-0.17676767676767674,-0.16666666666666663,-0.15656565656565652,-0.1464646464646464,-0.13636363636363635,-0.12626262626262624,-0.11616161616161613,-0.10606060606060602,-0.09595959595959591,-0.0858585858585858,-0.07575757575757575,-0.06565656565656564,-0.055555555555555525,-0.045454545454545414,-0.035353535353535304,-0.025252525252525193,-0.015151515151515138,-0.0050505050505050275,0.005050505050505083,0.015151515151515249,0.025252525252525304,0.03535353535353536,0.045454545454545525,0.05555555555555558,0.06565656565656575,0.0757575757575758,0.08585858585858586,0.09595959595959602,0.10606060606060608,0.11616161616161624,0.1262626262626263,0.13636363636363646,0.14646464646464652,0.15656565656565657,0.16666666666666674,0.1767676767676768,0.18686868686868696,0.19696969696969702,0.20707070707070718,0.21717171717171724,0.2272727272727273,0.23737373737373746,0.24747474747474751,0.2575757575757577,0.26767676767676774,0.2777777777777778,0.28787878787878796,0.297979797979798,0.3080808080808082,0.31818181818181823,0.3282828282828284,0.33838383838383845,0.3484848484848485,0.3585858585858587,0.36868686868686873,0.3787878787878789,0.38888888888888895,0.3989898989898991,0.40909090909090917,0.4191919191919192,0.4292929292929294,0.43939393939393945,0.4494949494949496,0.45959595959595967,0.4696969696969697,0.4797979797979799,0.48989898989898994,0.5],"y":[0.9557918508595763,0.9191866272004037,0.8829749330254193,0.8472001599889828,0.8119028833668585,0.7771209540925804,0.742889593170471,0.7092414878909483,0.6762068893104325,0.6438137104937397,0.6120876250512141,0.5810521655358546,0.5507288212972586,0.5211371354191955,0.4922948003959769,0.4642177522293864,0.43692026265268047,0.4104150292109915,0.38471326294819425,0.3598247734688571,0.3357580511600848,0.31252034637168524,0.2901177453639087,0.26855524283965737,0.24783681088213858,0.22796546411882715,0.20894332092757992,0.1907716604897257,0.17345097547656915,0.15698102012803747,0.1413608534424876,0.12658887714122014,0.11266286799463579,0.09958000399148563,0.08733688368690082,0.07592953786176676,0.06535343233937264,0.05560346039408152,0.04667392258482781,0.03855849094336587,0.03125015305318809,0.024741129327565572,0.01902275308673248,0.01408529654537315,0.009917713748857282,0.006507247218183268,0.00383879098111463,0.0018937638019872831,0.0006478038121514168,6.448947964211803e-05,6.780825170311772e-05,0.0006811412358226596,0.0019912210651399052,0.004036343417865032,0.006842123242940611,0.010428096433968406,0.014810143129911807,0.020001671526503097,0.026014286428636,0.03285820138769485,0.040542507257925596,0.04907535314146762,0.058464070164786434,0.06871525583618755,0.07983482991218703,0.09182806880212833,0.10469962319923795,0.11845352216151711,0.13309316591753406,0.14862130904035586,0.16504003520171745,0.1823507244184482,0.20055401349106164,0.21964975018273813,0.23963694157778434,0.2605136969800465,0.28227716565554983,0.30492346968423484,0.32844763215907025,0.3528435009542779,0.37810366827585207,0.4042193862055306,0.43118047845281804,0.45897524853771804,0.4875903846389745,0.5170108613583149,0.5472198386701548,0.5781985583481517,0.6099262381846654,0.6423799643464717,0.6755345822397436,0.7093625862893426,0.7438340090716065,0.7789163102760739,0.8145742660097435,0.8507698589974253,0.8874621702734042,0.9246072730027529,0.962158129115144,1.000064489479642],"type":"scatter"}], {"template":{"data":{"candlestick":[{"decreasing":{"line":{"color":"#000033"}},"increasing":{"line":{"color":"#000032"}},"type":"candlestick"}],"contourcarpet":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contourcarpet"}],"contour":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contour"}],"heatmap":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"heatmap"}],"histogram2d":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"histogram2d"}],"icicle":[{"textfont":{"color":"white"},"type":"icicle"}],"sankey":[{"textfont":{"color":"#000036"},"type":"sankey"}],"scatter":[{"marker":{"line":{"width":0}},"type":"scatter"}],"table":[{"cells":{"fill":{"color":"#000038"},"font":{"color":"#000037"},"line":{"color":"#000039"}},"header":{"fill":{"color":"#000040"},"font":{"color":"#000036"},"line":{"color":"#000039"}},"type":"table"}],"waterfall":[{"connector":{"line":{"color":"#000036","width":2}},"decreasing":{"marker":{"color":"#000033"}},"increasing":{"marker":{"color":"#000032"}},"totals":{"marker":{"color":"#000034"}},"type":"waterfall"}]},"layout":{"coloraxis":{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorscale":{"diverging":[[0.0,"#000021"],[0.1,"#000022"],[0.2,"#000023"],[0.3,"#000024"],[0.4,"#000025"],[0.5,"#000026"],[0.6,"#000027"],[0.7,"#000028"],[0.8,"#000029"],[0.9,"#000030"],[1.0,"#000031"]],"sequential":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"sequentialminus":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorway":["#000001","#000002","#000003","#000004","#000005","#000006","#000007","#000008","#000009","#000010"]}},"xaxis":{"title":{"text":"x_history"}},"yaxis":{"title":{"font":{"color":"blue"},"text":"y_history"},"tickfont":{"color":"blue"}}}, {"responsive": true} ) }; </script> </div>'}
Plot of y_history_vs_x_history
figures["y_history_vs_x_history"]
Total running time of the script: ( 0 minutes 0.866 seconds)
Download Python source code: plot_MockCurvesXRange_Dummy.py
Download Jupyter notebook: plot_MockCurvesXRange_Dummy.ipynb