Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
perceptualrobots committed Oct 15, 2023
1 parent 5b9f892 commit d551cff
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 13 deletions.
29 changes: 26 additions & 3 deletions nbs/12_yaw_module.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,29 @@
" 'training_steps': 500000,\n",
" }\n",
"\n",
" start, stop = get_indexes(model_params, properties)\n",
" # start = model_params['start_index']\n",
" # stop = model_params['stop_index']\n",
"\n",
" # if 'range' in properties:\n",
" # if properties['range']=='test':\n",
" # start = model_params['start_index_test']\n",
" # stop = model_params['stop_index_test']\n",
" # elif properties['range']=='all':\n",
" # stop = model_params['stop_index_test']\n",
"\n",
" return wind_timeseries,start, stop, model_params,yaw_params,keep_history"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17d37902",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"def get_indexes(model_params, properties):\n",
" start = model_params['start_index']\n",
" stop = model_params['stop_index']\n",
"\n",
Expand All @@ -246,7 +269,7 @@
" elif properties['range']=='all':\n",
" stop = model_params['stop_index_test']\n",
"\n",
" return wind_timeseries,start, stop, model_params,yaw_params,keep_history"
" return start, stop"
]
},
{
Expand All @@ -257,7 +280,7 @@
"outputs": [],
"source": [
"#| export\n",
"def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end, experiment=None,datatype='baseline_simu'):\n",
"def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end, experiment=None,datatype='baseline_simu', outdir=None):\n",
" '''\n",
" test CYCA-S and CYCA-L\n",
"\n",
Expand All @@ -282,7 +305,7 @@
"\n",
" plt.legend()\n",
" plotly_fig = tls.mpl_to_plotly(fig)\n",
" plot_file = f'res-{datatype}.html'\n",
" plot_file = f'{outdir}{sep}res-{datatype}.html'\n",
" plotly_fig.write_html(plot_file)\n",
"\n",
" if experiment:\n",
Expand Down
1 change: 1 addition & 0 deletions pct/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@
'pct.yaw_module.YawEnv.step': ('yaw_module.html#yawenv.step', 'pct/yaw_module.py'),
'pct.yaw_module.get_comparaison_metrics': ('yaw_module.html#get_comparaison_metrics', 'pct/yaw_module.py'),
'pct.yaw_module.get_dataset_from_simu': ('yaw_module.html#get_dataset_from_simu', 'pct/yaw_module.py'),
'pct.yaw_module.get_indexes': ('yaw_module.html#get_indexes', 'pct/yaw_module.py'),
'pct.yaw_module.get_properties': ('yaw_module.html#get_properties', 'pct/yaw_module.py'),
'pct.yaw_module.get_time_yawing': ('yaw_module.html#get_time_yawing', 'pct/yaw_module.py'),
'pct.yaw_module.get_yaw_count': ('yaw_module.html#get_yaw_count', 'pct/yaw_module.py'),
Expand Down
35 changes: 25 additions & 10 deletions pct/yaw_module.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/12_yaw_module.ipynb.

# %% auto 0
__all__ = ['get_yaw_count', 'get_time_yawing', 'oriented_angle', 'get_dataset_from_simu', 'get_properties', 'test_trad_control',
'YawEnv', 'get_comparaison_metrics', 'test_model_wind', 'test_hpct_wind']
__all__ = ['get_yaw_count', 'get_time_yawing', 'oriented_angle', 'get_dataset_from_simu', 'get_properties', 'get_indexes',
'test_trad_control', 'YawEnv', 'get_comparaison_metrics', 'test_model_wind', 'test_hpct_wind']

# %% ../nbs/12_yaw_module.ipynb 3
import warnings
Expand Down Expand Up @@ -161,6 +161,21 @@ def get_properties(properties):
'training_steps': 500000,
}

start, stop = get_indexes(model_params, properties)
# start = model_params['start_index']
# stop = model_params['stop_index']

# if 'range' in properties:
# if properties['range']=='test':
# start = model_params['start_index_test']
# stop = model_params['stop_index_test']
# elif properties['range']=='all':
# stop = model_params['stop_index_test']

return wind_timeseries,start, stop, model_params,yaw_params,keep_history

# %% ../nbs/12_yaw_module.ipynb 9
def get_indexes(model_params, properties):
start = model_params['start_index']
stop = model_params['stop_index']

Expand All @@ -171,10 +186,10 @@ def get_properties(properties):
elif properties['range']=='all':
stop = model_params['stop_index_test']

return wind_timeseries,start, stop, model_params,yaw_params,keep_history
return start, stop

# %% ../nbs/12_yaw_module.ipynb 9
def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end, experiment=None,datatype='baseline_simu'):
# %% ../nbs/12_yaw_module.ipynb 10
def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end, experiment=None,datatype='baseline_simu', outdir=None):
'''
test CYCA-S and CYCA-L
Expand All @@ -199,7 +214,7 @@ def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end,

plt.legend()
plotly_fig = tls.mpl_to_plotly(fig)
plot_file = f'res-{datatype}.html'
plot_file = f'{outdir}{sep}res-{datatype}.html'
plotly_fig.write_html(plot_file)

if experiment:
Expand Down Expand Up @@ -238,7 +253,7 @@ def test_trad_control(wind_timeseries, wind_timeseries_not_agg,agg, start, end,



# %% ../nbs/12_yaw_module.ipynb 10
# %% ../nbs/12_yaw_module.ipynb 11
class YawEnv(Env):

def initialise(self, properties ):
Expand Down Expand Up @@ -439,7 +454,7 @@ def reset(self):

return self.state

# %% ../nbs/12_yaw_module.ipynb 11
# %% ../nbs/12_yaw_module.ipynb 12
def get_comparaison_metrics(wind_direction,power_control,power_simu,res_model, res_baseline_simu, yaw_rate, yaw_power, width_bin) :
res_model_diff = pd.Series(res_model).diff(1).fillna(0)
res_baseline_simu_diff = pd.Series(res_baseline_simu).diff(1).fillna(0)
Expand Down Expand Up @@ -475,7 +490,7 @@ def get_comparaison_metrics(wind_direction,power_control,power_simu,res_model, r



# %% ../nbs/12_yaw_module.ipynb 12
# %% ../nbs/12_yaw_module.ipynb 13
def test_model_wind(wind_timeseries,start_index,stop_index,ancestors,filter_duration,yaw_parameters,experiment=None,datatype='test'):
'''
test RLYCA
Expand Down Expand Up @@ -553,7 +568,7 @@ def test_model_wind(wind_timeseries,start_index,stop_index,ancestors,filter_dura
env.history["power_trad"],


# %% ../nbs/12_yaw_module.ipynb 13
# %% ../nbs/12_yaw_module.ipynb 14
def test_hpct_wind(file=None,plots=None,history=None,verbose=None,outdir=None,early=None,environment_properties=None,start_index=None,stop_index=None,experiment=None,datatype='test', draw_file=None, model_file=None):
'''
test RLYCA
Expand Down

0 comments on commit d551cff

Please sign in to comment.