<s> from eemeter . models import AverageDailyTemperatureSensitivityModel <EOL> from numpy . testing import assert_allclose <EOL> import numpy as np <EOL> import pytest <EOL> def test_average_daily_baseload_heating_cooling_consumption_model ( ) : <EOL> initial_params = { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> } <EOL> param_bounds = { <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:50> , <NUM_LIT> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT> ] , <EOL> } <EOL> model = AverageDailyTemperatureSensitivityModel ( cooling = True , heating = True , initial_params = initial_params , param_bounds = param_bounds ) <EOL> params = model . param_type ( [ <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT:1> ] ) <EOL> observed_temps = np . array ( [ [ i ] for i in range ( <NUM_LIT:50> , <NUM_LIT> ) ] ) <EOL> usages = model . transform ( observed_temps , params ) <EOL> assert_allclose ( usages [ <NUM_LIT:8> : <NUM_LIT> ] , [ <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , rtol = <NUM_LIT> , atol = <NUM_LIT> ) <EOL> opt_params = model . fit ( observed_temps , usages ) <EOL> assert_allclose ( params . to_list ( ) , opt_params . to_list ( ) , rtol = <NUM_LIT> , atol = <NUM_LIT> ) <EOL> def test_TemperatureSensitivityModel_with_heating ( ) : <EOL> initial_params = { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> } <EOL> param_bounds = { <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:50> , <NUM_LIT> ] , <EOL> } <EOL> model = AverageDailyTemperatureSensitivityModel ( heating = True , cooling = False , initial_params = initial_params , param_bounds = param_bounds ) <EOL> params = model . param_type ( [ <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT:1> ] ) <EOL> observed_temps = np . array ( [ [ i ] for i in range ( <NUM_LIT:50> , <NUM_LIT> ) ] ) <EOL> usages = model . transform ( observed_temps , params ) <EOL> assert_allclose ( usages [ <NUM_LIT:8> : <NUM_LIT> ] , [ <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] , rtol = <NUM_LIT> , atol = <NUM_LIT> ) <EOL> opt_params = model . fit ( observed_temps , usages ) <EOL> assert_allclose ( params . to_list ( ) , opt_params . to_list ( ) , rtol = <NUM_LIT> , atol = <NUM_LIT> ) <EOL> def test_TemperatureSensitivityModel_with_cooling ( ) : <EOL> initial_params = { <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> } <EOL> param_bounds = { <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:100> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT> , <NUM_LIT> ] , <EOL> } <EOL> model = AverageDailyTemperatureSensitivityModel ( heating = False , cooling = True , initial_params = initial_params , param_bounds = param_bounds ) <EOL> params = model . param_type ( [ <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT:1> ] ) <EOL> observed_temps = np . array ( [ [ i ] for i in range ( <NUM_LIT:50> , <NUM_LIT> ) ] ) <EOL> usages = model . transform ( observed_temps , params ) <EOL> assert_allclose ( usages [ <NUM_LIT:8> : <NUM_LIT> ] , [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> opt_params = model . fit ( observed_temps , usages ) <EOL> assert_allclose ( params . to_list ( ) , opt_params . to_list ( ) , rtol = <NUM_LIT> , atol = <NUM_LIT> ) <EOL> def test_model_weather_input_not_np_array ( ) : <EOL> model = AverageDailyTemperatureSensitivityModel ( heating = False , cooling = False ) <EOL> params = model . param_type ( [ <NUM_LIT:1> ] ) <EOL> observed_temps = [ [ <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] <EOL> usages = model . transform ( observed_temps , params ) <EOL> assert_allclose ( usages , [ <NUM_LIT:1> , <NUM_LIT:1> ] , rtol = <NUM_LIT> , atol = <NUM_LIT> ) </s>
