Data2Dynamics / d2d

a modeling environment tailored to parameter estimation in dynamical systems
https://github.com/Data2Dynamics/d2d
57 stars 28 forks source link

New arLoadData #151

Closed mhyamani closed 2 years ago

mhyamani commented 4 years ago

The new arLoadData enables users to add, update, or change the whole data struct or some parts of it before compilation. It works like the existing arLoadModel and accepts all the inputs that the current arLoadData accepts plus two more fields for expilicitly appending data struct.

mhyamani commented 4 years ago

More Info:

The new arLoadData consists of five subfunctions: arLoadData(name, [m], [extension], [removeEmptyObs], [mixingCond], [fieldsvar], [opts])}

  1. arReadDataFile reads the data file (xls, xlsx, and cvs) and stores the raw data to a local variable.

  2. arReadDefFile reads the .def file and stores it to the local variable.

  3. arCreateDataStruture (new version of arCreateDataStruct) accepts two new variables, fieldsvar and mixingCond 3.1. fieldsvar enables the user to explicitly import new data struct without using .def file. This variable serves as pold, fp and varargin which is defined in old version arCreateDataStruct. for more information about how it works see the function help. The point is that the data can be imported exactly in the same way of creating .def and .xls files. The user doesn't need to explicitly write the parameters or do any other extra work. All the parsing process is done by the new arAddDataStructure. 3.2. mixingCond: the new arLoadData enables users to read data definition from file or create it via an input variable or mix these two together. Suppose there are .def and .xls files. You can update or add data struct to them and compile it. All these possible combinations of updating, adding, and replacing is defined by variable mixingCond.

  4. arAddDataDefInfo combines .def and data files and creates a single data struct and appends it to the global ar. If any data is explicitly imported by variable (either new data struct or updating the existing one), new .def and .xls files in the \Data folder are automatically generated that contains the data definition file and the data itself. This feature enables the user to keep them for her/his record or compile it again later.

“All of the above four functions are independent of global ar”

  1. arAddDataStructure compares the data struct with ar.model(m), updates the data struct, parse it, and add it to ar.model(m). The plot field is also created in this function.

** Because of technical issues, It wasn't possible to use existing arAddDataStruct and arCreateDataStruct.