Coverage for pygeodyn/generic/algo.py: 78%
18 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-22 13:43 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-22 13:43 +0000
1#!/usr/bin/env python3
2#-*- coding: utf-8 -*-
4from ..inout.config import ComputationConfig
6class GenericAlgo:
7 """
8 Base class that defines the interface of Algo for it to be used in run.py
9 """
10 name = 'base'
12 def __init__(self, config, nb_realisations):
13 if not isinstance(config, ComputationConfig):
14 raise TypeError('The config used to initialise {} is not a ComputationConfig object ! Got an argument of type {} instead.'.format(type(self).__name__, type(config)))
15 self.config = config
16 if int(nb_realisations) <= 0:
17 raise ValueError('Number of realisation should be a positive int ! Got {} instead.'.format(nb_realisations))
18 self.nb_realisations = int(nb_realisations)
20 def init_corestates(self, random_state=None):
21 raise NotImplementedError()
23 def analysis_step(self, input_core_state, analysis_time):
24 raise NotImplementedError()
26 def forecast_step(self, input_core_state, random_state=None):
27 raise NotImplementedError()
29 def get_current_misfits(self, measure):
30 return 0