def __init__()

in lab/03-Package-Deploy/greengrass-v2/artifacts/aws.samples.windturbine.detector/1.0.0/inference/windturbine.py [0:0]


    def __init__(self, turbine_id, agent_socket, model_path, model_name):
        if turbine_id is None:
            raise Exception("You need to pass the turbine id as argument")
        
        self.running = False # running status

        self.msg_client = msg_client.MessagingClient(turbine_id)
        self.msg_client.subscribe_to_data(self.__data_handler__)
#         self.msg_client.subscribe_to_status(self.__callback_is_turbine_running__)

        ## launch edge agent client
        self.edge_agent = EdgeAgentClient(agent_socket)
        self.model_meta = {
            "model_name" : model_name,
            "model_path" : model_path
        }

        self.acc_buffer = []   
        self.dashboard_buffer = []
        self.model_loaded = False

        self.resp = self.edge_agent.load_model(model_name, model_path)
        if self.resp is None: 
            logging.error('It was not possible to load the model. Is the agent running?')
            sys.exit(1)
        self.model_loaded = True 
        model_loaded= {"model_label_status" : "Model Loaded"}
        self.msg_client.publish_model_status(model_loaded)
        

        # we need to load the statistics computed in the data prep notebook
        # these statistics will be used to compute normalize the input
        file_path = os.path.dirname(__file__)
        logging.info(f"Reading stats from {file_path}")
        self.raw_std = np.load(os.path.join(file_path, '../statistics/raw_std.npy'))
        self.mean = np.load(os.path.join(file_path, '../statistics/mean.npy'))
        self.std = np.load(os.path.join(file_path, '../statistics/std.npy'))
        # then we load the thresholds computed in the training notebook
        # for more info, take a look on the Notebook #2
        self.thresholds = np.load(os.path.join(file_path, '../statistics/thresholds.npy'))
        
        # configurations to format the time based data for the anomaly detection model
        # If you change these parameters you need to retrain your model with the new parameters        
        self.INTERVAL = 5 # seconds
        self.TIME_STEPS = 20 * self.INTERVAL # 50ms -> seg: 50ms * 20
        self.STEP = 10
        
        # these are the features used in this application
        self.feature_ids = [8,9,10,7,  22, 5, 6] # qX,qy,qz,qw  ,wind_seed_rps, rps, voltage        
        self.n_features = 6 # roll, pitch, yaw, wind_speed, rotor_speed, voltage
        
        
        # minimal buffer length for denoising. We need to accumulate some sample before denoising
        self.min_num_samples = 500