Hi, I'm trying to make a robust way to strip the model terms from the model script. So this is an example script (automatically created with custom DOE):
Fit Model(
Y( :Thickness Removed ),
Effects(
:Name( "Gas Type{1&1-3}" ),
:Name( "Gas Type{1-3}" ),
:Temperature,
:Plasma Power,
:Plasma Time,
:Etch Gas Flow,
:Reactor Pressure,
:Name( "Gas Type{1&2-3}" ) * :Temperature,
:Name( "Gas Type{1&2-3}" ) * :Plasma Power,
:Name( "Gas Type{1&2-3}" ) * :Plasma Time,
:Name( "Gas Type{1&2-3}" ) * :Etch Gas Flow,
:Name( "Gas Type{1&2-3}" ) * :Reactor Pressure,
:Temperature * :Reactor Pressure,
:Plasma Power * :Plasma Time,
:Plasma Power * :Etch Gas Flow,
:Temperature * :Temperature
),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" )
)
I'm interested in getting a list of the factors that are present within the effects() section. And the list of model terms in the same part of the string. The problem is the total length of the string can vary, the number of parenthesis can vary and the order of Y(), Effects(), Personality(), Emphasis() can move around.
Things it thought of but don't know how to do:
- use words to split the string on "," but only on the highest level. Now find the word that starts with effects and then split that again on ",". The ones without "*" are the factors, the whole thing is the list of model terms.
- Find "Effects" then start counting, every "(" is +1 every ")" is -1 and when you get to 0 that was the last closing parenthesis belonging to Effects now use substr to strip out that part.
But it seems to me there should be an easier way to parse the script since that is what the scripting language does.