1 /*****************************************************************************
2    Major portions of this software are copyrighted by the Medical College
3    of Wisconsin, 1994-2000, and are released under the Gnu General Public
4    License, Version 2.  See the file README.Copyright for details.
5 ******************************************************************************/
6 
7 /*
8   This file contains routines to initialize and implement the
9   zero noise model.
10 
11 Copied from model_null.c, the null signal model
12   and from model_constant.c, the constant noise model
13   File:     model_zero.c
14   Author:   Daniel Glen
15   Date:     26 Oct 2006
16 */
17 
18 
19 /*---------------------------------------------------------------------------*/
20 
21 /*#include <math.h>*/
22 #include "NLfit_model.h"
23 
24 void noise_model
25 (
26   float * gn,                /* parameters for noise model */
27   int ts_length,             /* length of time series data */
28   float ** x_array,          /* independent variable matrix */
29   float * ts_array           /* estimated noise model time series */
30 );
31 
32 
33 /*---------------------------------------------------------------------------*/
34 /*
35   Routine to initialize the noise model by defining the number of parameters
36   in the noise model, the name of the noise model, and the default values
37   for the minimum and maximum parameter constraints.
38 */
39 
40 DEFINE_MODEL_PROTOTYPE
41 
initialize_model()42 MODEL_interface * initialize_model ()
43 {
44   MODEL_interface * mi = NULL;
45 
46 
47   /*----- allocate memory space for model interface -----*/
48   mi = (MODEL_interface *) RwcMalloc (sizeof(MODEL_interface));
49 
50 
51   /*----- define interface for the zero noise model -----*/
52 
53   /*----- name of this model -----*/
54   strcpy (mi->label, "Zero");
55 
56   /*----- this is a noise model -----*/
57   mi->model_type = MODEL_NOISE_TYPE;
58 
59   /*----- number of parameters in the model -----*/
60   mi->params = 0;
61 
62   /*----- minimum and maximum parameter constraints -----*/
63   /*----- there are none -----*/
64 
65   /*----- function which implements the model -----*/
66   mi->call_func = &noise_model;
67 
68 
69   /*----- return pointer to the model interface -----*/
70   return (mi);
71 }
72 
73 
74 /*---------------------------------------------------------------------------*/
75 /*
76   Routine to calculate the time series which results from using the
77   zero noise model.
78 */
79 
noise_model(float * gn,int ts_length,float ** x_array,float * ts_array)80 void noise_model
81 (
82   float * gn,                /* parameters for noise model */
83   int ts_length,             /* length of time series data */
84   float ** x_array,          /* independent variable matrix */
85   float * ts_array           /* estimated noise model time series */
86 )
87 
88 {
89   int it;                           /* time index */
90 
91 
92   for (it = 0;  it < ts_length;  it++)
93     ts_array[it] = 0.0;
94 
95 }
96 
97 
98 
99 
100