Example #1
0
        } /* DoRunProtocol() */

        public void DoBlockConfiguration(UXF.Block block, System.Collections.Generic.List <string> seq)
        {
            // iterate over seq
            UXF.Settings pattern_settings = new UXF.Settings(block.settings.GetDict("trial_pattern"));
            foreach (var item in seq.Select((pattern, index) => new { index, pattern }))
            {
                // extract pattern dictionary
                UXF.Settings current_pattern_settings = new UXF.Settings(pattern_settings.GetDict(item.pattern));

                // assign a pattern name (internal)
                block.trials[item.index].settings.SetValue(
                    "current_pattern",
                    item.pattern
                    );

                // iterate over each found keys
                foreach (string key in current_pattern_settings.Keys)
                {
                    // extract specific per trial settings
                    block.trials[item.index].settings.SetValue(
                        key,
                        current_pattern_settings.GetObject(key)
                        );
                } /* foreach() */
            }     /* foreach() */
        }         /* DoBlockConfiguration() */
 public void Init(UXF.Session session)
 {
     this.session = session;
     mainBlock    = session.CreateBlock();
 }
Example #3
0
        }         /* DoBlockConfiguration() */

        public void DoSessionConfiguration(UXF.Session session)
        {
            // retrieve the block sequence, which was loaded from our .json file
            System.Collections.Generic.List <string> seq = session.settings.GetStringList("block_sequence");

            // iterate over seq
            UXF.Settings pattern_settings = new UXF.Settings(session.settings.GetDict("block_pattern"));
            foreach (var item in seq.Select((pattern, index) => new { index, pattern }))
            {
                // extract pattern dictionary
                UXF.Settings current_pattern_settings = new UXF.Settings(pattern_settings.GetDict(item.pattern));

                // create block
                UXF.Block block = session.CreateBlock(current_pattern_settings.GetStringList("trial_sequence").Count);

                // assign settings
                block.settings.SetValue("current_pattern", item.pattern);
                block.settings.SetValue("is_practice_condition", current_pattern_settings.GetBool("is_practice_condition"));

                // call child configuration
                this.DoBlockConfiguration(block, current_pattern_settings.GetStringList("trial_sequence"));

                // suffle it !
                if (current_pattern_settings.GetBool("is_sequence_randomized"))
                {
                    block.trials.Shuffle();
                }
            } /* foreach() */

            // retrieve the inter trial setting, which was loaded from our .json file
            if (session.settings.Keys.ToList().Contains("trial_inter_sleep_duration_ms"))
            {
                this._trial_sleep_duration = session.settings.GetFloat("trial_inter_sleep_duration_ms");
            }
            else
            {
                // log
                UnityEngine.Debug.LogWarning(
                    "<color=Orange>Info: </color> ApollonAbstractExperimentProfile.onExperimentTrialEnd() : could not find settings with key [trial_inter_sleep_duration_ms], set to default value :"
                    + this._trial_sleep_duration
                    );
            }

            if (session.settings.Keys.ToList().Contains("trial_final_fade_in_duration_ms"))
            {
                this._trial_fade_in_duration = session.settings.GetFloat("trial_final_fade_in_duration_ms");
            }
            else
            {
                // log
                UnityEngine.Debug.LogWarning(
                    "<color=Orange>Info: </color> ApollonAbstractExperimentProfile.onExperimentTrialEnd() : could not find settings with key [trial_final_fade_in_duration_ms], set to default value :"
                    + this._trial_fade_in_duration
                    );
            } /* if() */

            if (session.settings.Keys.ToList().Contains("trial_initial_fade_out_duration_ms"))
            {
                this._trial_fade_out_duration = session.settings.GetFloat("trial_initial_fade_out_duration_ms");
            }
            else
            {
                // log
                UnityEngine.Debug.LogWarning(
                    "<color=Orange>Info: </color> ApollonAbstractExperimentProfile.onExperimentTrialEnd() : could not find settings with key [trial_initial_fade_out_duration_ms], set to default value :"
                    + this._trial_fade_out_duration
                    );
            } /* if() */
        }     /* DoSessionConfiguration() */