Read out certain levels only

Vera vera.donk at googlemail.com
Wed May 19 11:42:34 UTC 2010


David,

thanks for the reply. I had already been trying to have a look at the
code generated by E-Prime (and I already tried to do what you did with
the Set List.Deletion = PickOne(c.GetAttrib("AnyAttribYouLike")) , but
it generated another number of errors).

Anyway, we found a solution now (we just have two different lists
(which is not the solution I prefer, because it gets incredibly messy
with Labels and Gotos in all directions, but hey, it's working, and
that was the goal...)).

I think that you are right that the weight level solution isn't the
best one.

We tried to apply another one, working with two arrays, which I think
is the perfect, cleanest solution (unfortunately I am not a
programming hero and so I got it almost to working, but I am still
convinced to get it working someday). As time was running out, we took
the "E-Prime solution" (mentionned above, including two designlists
and a lot of Labels and Gotos) which as I said is working.

To the trigger value question, you are probably right that I should
foresee what happens is the trigger is < 0 or > 7. But in practice
this will just not happen, as we are using the first 4 bits of a
parallelport only (0, 1, 2, 4). :-) Thanks for the general programming
tip though.

So thanks to you and Michiel for trying to help me out!

Greetings, Vera

On May 11, 4:33 pm, David McFarlane <mcfar... at msu.edu> wrote:
> Vera,
>
> Don't know why your code does not work, but just
> a couple comments on your code fragment here...
>
> First, almost every time we have resorted to
> using List.SetWeight it turned out that we had a
> poor design structure, and once we restructured
> the design it eliminated the need for
> List.SetWeight and solved a host of other lurking
> problems as well.  So I urge you to first take a
> serious look at your design structure.
>
> Next, when we did use List.SetWeight, we
> absolutely had to execute a List.Reset, otherwise
> the List ignored our .SetWeight changes.  So if
> your code does not work with the List.Reset
> command in place, then your code has other problems.
>
> And since you must do the List.Reset for either
> branch of the If...Then...ElseIf, then you may as
> well pull it out from within the branches and put
> it after the whole If...Then...ElseIf block.
>
> Finally, what happens if TriggerValue < 0 or
> TriggerValue >= 7?  As it stands, in this case
> your code will simply leave the List intact.  Is
> this what you meant?  Perhaps you think it
> impossible for TriggerValue to ever take on
> values outside of 0-6, but good coding practice
> requires that you either include a final Else to
> handle outliers or at least add a comment to
> explain what you mean the code to do.
>
> So just as an exercise, here is your code
> fragement again (keeping your TriggerValue
> variable because I do not want to get into that
> issue, using "<=" instead of "<" just because I
> think that makes the intent clearer, and adding a
> Const to get rid of one "magic number"; hmm, on
> further thought I restructured this to pull the
> common inner loops out of the main loop, etc.):
>
> Const TriggerValueMax as Integer = 6
> Dim nLevel as Integer
> Dim TriggerValue as Integer, TriggerValueToRun as Integer
> ' Assign TriggerValueToRun based on NewTriggerValue:
> If (NewTriggerValue = 0) Then
>      TriggerValueToRun = 0
> ElseIf ((1 <= NewTriggerValue) AND _
>      (NewTriggerValue <= TriggerValueMax)) Then
>      TriggerValueToRun = 1
> Else MsgBox "NewTriggerValue " & NewTriggerValue _
>          & "out of range!  Please contact programmer."
> End If
> ' Now set List level weights according to match between TriggerValue &
> ' TriggerValueToRun:
> For nLevel = 1 to DesignList.Size
>      TriggerValue = DesignList.GetAttrib(nLevel,"Trigger")
>      If TriggerValue = TriggerValueToRun Then
>          DesignList.SetWeight nLevel, 1
>      Else DesignList.SetWeight nLevel, 0
>      End If
> Next nLevel
> DesignList.Reset
>
> Or just for fun, let's do this with a Select Case:
>
> Const TriggerValueMax as Integer = 6
> Dim nLevel as Integer
> Dim TriggerValue as Integer, TriggerValueToRun as Integer
> ' Assign TriggerValueToRun based on NewTriggerValue:
> Select Case NewTriggerValue
> Case 0
>      TriggerValueToRun = 0
> Case 1 to 6
>      TriggerValueToRun = 1
> Case Else
>      MsgBox "NewTriggerValue " & NewTriggerValue _
>          & "out of range!  Please contact programmer."
> End Select
> ' Now set List level weights according to match between TriggerValue &
> ' TriggerValueToRun:
> For nLevel = 1 to DesignList.Size
>      TriggerValue = DesignList.GetAttrib(nLevel,"Trigger")
>      If TriggerValue = TriggerValueToRun Then
>          DesignList.SetWeight nLevel, 1
>      Else DesignList.SetWeight nLevel, 0
>      End If
> Next nLevel
> DesignList.Reset
>
> -- David McFarlane, Professional Faultfinder
>
> At 5/7/2010 01:11 PM Friday, you wrote:
>
> >:-(
>
> >I seem to have cheered too early. :-( Some filteringin E-DataAid
> >showed that E-Prime is still exactly doing as it likes.
>
> >I also had some mistakes in the previous code, here it is again:
>
> >Dim nLevel as Integer
> >Dim TriggerValue as Integer
>
> >If (NewTriggerValue > 0) AND (NewTriggerValue < 7) Then
> >         For nLevel = 1 to DesignList.Size
> >         TriggerValue = DesignList.GetAttrib(nLevel,"Trigger")
> >                 If TriggerValue = 1 Then
> >                         DesignList.SetWeight nLevel, 1
> >                 Else DesignList.SetWeight nLevel, 0
> >                 End If
> >         Next nLevel
> >'       DesignList.Reset
> >ElseIf NewTriggerValue = 0 Then
> >         For nLevel = 1 to DesignList.Size
> >         TriggerValue = DesignList.GetAttrib(nLevel,"Trigger")
> >                 If TriggerValue = 0 Then
> >                         DesignList.SetWeight nLevel, 1
> >                 Else DesignList.SetWeight nLevel, 0
> >                 End If
> >         Next nLevel
> >'       DesignList.Reset
> >End If
>
> >A few remarks to this code:
>
> >1. E-Prime is still doing what it likes, guaranteeing me no
> >counterbalancing whatsoever.
> >2. I had to add: TriggerValue = DesignList.GetAttrib(nLevel,"Trigger")
> >- If TriggerValue = 0 Then and I know I could have been doing that
> >more elegantly (like you did Michiel), but then E-Prime complains that
> >there are "too many variables".
> >3. If I add this piece of code, not only will E-Prime still not do
> >what I expect it to do, but it will also generate blocks as it likes.
> >Sometimes 3, sometimes 4... But never 7 as it is supposed to do!! In
> >my last test run it even stopped in the middle of a trial going
> >immediately to the block feedback! Anybody any idea why that could be?
> >It seems to me that this piece of script has nothing to do with the
> >number of blocks or anything.
> >4. As you can see, DesignList.Reset has been commented out, because
> >when I add this, E-Prime runs only one trials (instead of 36 in a
> >normal block) and then goes immediately to the Block Feedback.
>
> >I don't understand this program, it makes absolutely no sense to me. :-
> >(
>
> >Greetings, Vera
>
> >On 7 Mai, 17:05, Vera <vera.d... at googlemail.com> wrote:
> > > Ok, found a way to be at the experimental setup AND have internet
> > > (whew!!!). ;-)
>
> > > So the thing I did was:
>
> > > If (NewTriggerValue > 0) AND (NewTriggerValue < 7) Then
> > >    For nLevel = 1 to DesignList.Size
> > >         If c.GetAttrib("Trigger") = "1" Then
> > >                DesignList.SetWeight nLevel, 1
> > >         Else DesignList.SetWeight nLevel, 0
> > >         End If
> > >    Next nLevel
> > > ElseIf NewTriggerValue = 0 Then
> > >    For nLevel = 1 to DesignList.Size
> > >         If c.GetAttrib("Trigger") = "0" Then
> > >                DesignList.SetWeight nLevel, 1
> > >         Else DesignList.SetWeight nLevel, 0
> > >         End If
> > >    Next nLevel
> > > End If
>
> > > And now that I could finally connect, I see that you proposed me the
> > > same thing. :-)
> > > And the best thing: it works!!!! Checked the database with E-DataAid
> > > and it's all perfectly balanced. :-)
>
> > > Thanks a lot for giving me the idea!
>
> > > Have a great weekend!
>
> > > Vera
>
> > > On 7 Mai, 13:42, Vera <vera.d... at googlemail.com> wrote:
>
> > > > Ok, I now had a closer look at your solution (I wasn't on the right PC
> > > > before, with the USB-stick-licence it's kind of a hassle sometimes,
> > > > making a lot of kms in the institute! ;-) ) and I think I might try
> > > > something with your solution.
>
> > > > So to get back at your question:
>
> > > > "If trigger 1 then PLEASE take only line 1"
> > > > ...
> > > > "You mean, of a list, right?"
>
> > > > Yes, I mean of a list (so a level of a list). Of course I simplified
> > > > the whole a bit, pretending that I had only two levels in my list and
> > > > two triggers. In reality I have 20 lines and two triggers (so the list
> > > > kind of gets separated into two). :-)
>
> > > > So basically what I want to do is
> > > > "If trigger = 1 then take any of the lines for which attribute.trigger
> > > > = 1" (any of 10 in a random manner)
>
> > > > Oh and then don't worry about TMS, it's already all working fine. :-)
> > > > I am getting the triggers and all, E-Prime just doesn't know what to
> > > > do with them for the moment (ok if I am more precise: E-Prime knows
> > > > what to do with the triggers, but I can't control the conditions,
> > > > making sure that the design is completely perfectly counterbalanced
> > > > over the two conditions). :-)
>
> > > > I am going back to my experimental setup again, seeing what I can do
> > > > with your solution in mind. I definitely should get internet there,
> > > > but that's the hassle with experimental computers: you want to keep
> > > > them clean from anything that might slow them such as anti-virus and
> > > > stuff. :-| But feel free to reply if you came up with another idea, I
> > > > will check for input anyway. :-)
>
> > > > Greetings, Vera
>
> > > > On May 7, 12:25 pm, Michiel Spape <Michiel.Sp... at nottingham.ac.uk>
> > > > wrote:
>
> > > > > Hi Vera & Group,
> > > > > I like that "Sudoku-effect"! In fact, I
> > think I might have misstated that nested-lists
> > are untrustworthy - in general, people are much
> > more prone to making errors than computers, and
> > indeed, this to me is the main problem of
> > nested lists. I do, however, use them all the
> > time, myself, but usually not for my main 'triallist'.
>
> > > > > Anyway, I'm sorry for the lack of help
> > I'm going to offer, I'm just not entirely clear
> > on what you want to achieve. Do you want to run
> > certain conditions based on a trigger readout
> > from TMS (err, I never worked with TMS)? Does
> > that mean certain stimuli? Certain different orderings?
>
> > > > > Lacking a clear idea on what exactly it
> > is you want, I can help with certain specifics:
>
> > > > > "If trigger 1 then PLEASE take only line 1"
> > > > > ...
> > > > > You mean, of a list, right?
>
> > > > > This can be achieved in a quick and dirty
> > way by adding a bit of inline that sets all
> > weights of a list to 0 except line 1. From E-basic help, and adjusted
>
> > > > > Dim nLevel As Integer 'originally Long,
> > but how many people really have lists that have more than 32768 levels?
> > > > > For nLevel = 1 To List1.Size
> > > > >         If nLevel = 1 then
> > List1.SetWeight nLevel, 1 else List1.SetWeight nLevel, 0
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list