-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: restructure parameter containing structs
by embedding in another struct and composing at a top level, can more easily start to capture additional information
- Loading branch information
Showing
5 changed files
with
105 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package parser | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// ParseExtLines parses out the ext lines into a data structure for final parameter processing. | ||
func ParseExtLines(lines []string) ExtData { | ||
var estimationMethods []string | ||
var estimationSteps [][]string | ||
var estimationStep []string | ||
var paramNames []string | ||
for _, line := range lines { | ||
if strings.HasPrefix(line, "TABLE") { | ||
estimationMethods = append(estimationMethods, line) | ||
if len(estimationStep) > 0 { | ||
// if not the first one, means its ready to save off | ||
estimationSteps = append(estimationSteps, estimationStep) | ||
estimationStep = []string{} //reset | ||
} | ||
} else { | ||
if strings.HasPrefix(line, " ITER") && len(paramNames) == 0 { | ||
paramNames = strings.Fields(line) | ||
} else { | ||
continue | ||
} | ||
estimationStep = append(estimationStep, line) | ||
} | ||
} | ||
estimationSteps = append(estimationSteps, estimationStep) | ||
// final estimation step will still need to get added to estimationSteps | ||
return ExtData{ | ||
EstimationMethods: estimationMethods, | ||
ParameterNames: paramNames, | ||
EstimationLines: estimationSteps, | ||
} | ||
} | ||
|
||
// GetFinalParameterEstimates returns the ExtData in the structure of final parameter estimates | ||
// func GetFinalParameterEstimates(extData ExtData) { | ||
// var finalParameterEstimates ParametersData | ||
// var finalParameterStdErr ParametersData | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters