GithubHelp home page GithubHelp logo

Comments (13)

nzjrs avatar nzjrs commented on July 28, 2024

for context: #15

blocked by 'who decides the end in a general case in a multi backend experiment with different playlists'? the longest union of playlists when all were stopped? ultimately there was not enough state to know that there was no possibility for an externa API call to not continue playing by switching to another item, so I elected to allow such logic to be in the python code if one does an Experment.py experiment, or in the yaml explicitly based on time - because if done explicitly in the yaml which will contain all stims for all backends the writer of the yaml at that time has the best and most correct definition of when the total experiment is finished

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

Ah!! @nzjrs thanks so much for bringing this to my attention. I was able to get this to work in the time/do stanza, but I have not figured out how to implement this in the experiment.py file. Following your example in flyvr design I tried to write something that shows a stimulus a few times (randomly picking) and then stops the experiment but Max and I couldn't figure out how to get the experiment to stop...
exp_a_stop.txt

(sorry for the .txt file, it won't let me drag a .py in)
I tried these in line 40
Experiment._shared_state.signal_stop().join(timeout=5) // AttributeError: type object 'Experiment' has no attribute '_shared_state'
Experiment.stop() // just doesn't stop
self.stop() // also doesn't work - sorry I forgot to write down the error message for this

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

Ah!! @nzjrs thanks so much for bringing this to my attention. I was able to get this to work in the time/do stanza, but I have not figured out how to implement this in the experiment.py file. Following your example in flyvr design I tried to write something that shows a stimulus a few times (randomly picking) and then stops the experiment but Max and I couldn't figure out how to get the experiment to stop... exp_a_stop.txt

(sorry for the .txt file, it won't let me drag a .py in) I tried these in line 40 Experiment._shared_state.signal_stop().join(timeout=5) // AttributeError: type object 'Experiment' has no attribute '_shared_state' Experiment.stop() // just doesn't stop self.stop() // also doesn't work - sorry I forgot to write down the error message for this

ok, this seems like a bug where the Experiment object does not have _shared_state set. Are you launching this the normal flyvr.exe way, or are you launching the experiment process manually?

If launching manually, this line should be called

self.experiment._set_shared_state(flyvr_shared_state)

which means that Experiment.stop() should not crash.

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

hmmm I was launching the normal way. Here's the command from Cmder:

flyvr -c config_avd_items.yml -e exp_a_stop.py --fictrac_version 2

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

ok, can you check the log to see if it prints this message

self._log.info('initialized experiment %r' % options.experiment)

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

are you referring to this type of log?

fictrac-20220211_141159.log

no, I don't see any mention of "experiment"

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

which line should I test with (in the .py file), is it this one:
Experiment.stop()
?

not
Experiment._shared_state.signal_stop().join(timeout=5)
?

will report back in a few...

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

which line should I test with (in the .py file), is it this one: Experiment.stop() ?

not Experiment._shared_state.signal_stop().join(timeout=5) ?

will report back in a few...

self.stop() but if there isn't a log of the experiment being initialized then there is a bug somewhere else

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

oof. I did a bunch of testing and it is unclear to me what the pattern/problem/output is.

with the .py file I wrote above (where I try to play some audio, and after some number of times playing, I want to stop the experiment), with Experiment.stop() the initialization line shows up in the console:
flyvr.fictrac.FicTracDriver : INFO initialized experiment <exp_a_stop._MyExperiment object at 0x000001B37F05C488>
and also this error:

Process Process-3:
Traceback (most recent call last):
  File "C:\Users\murthylab\miniconda3\envs\flyvr\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\murthylab\miniconda3\envs\flyvr\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "c:\fly-vr\flyvr\fictrac\fictrac_driver.py", line 189, in run
    self.experiment.process_state(data_copy)
  File "exp_a_stop.py", line 40, in process_state
    Experiment.stop()
TypeError: stop() missing 1 required positional argument: 'self'

with self.stop(), SOMETIMES experiment is there
flyvr.fictrac.FicTracDriver : INFO initialized experiment <exp_a_stop._MyExperiment object at 0x00000209EC20D408>
but it ignores the exp file and just plays the playlist in order on repeat!

OTHER TIMES it does not work at all, most recently using:
exp_a_stop.txt
config_a_items.txt
I used the same config and decided to just write a super basic experiment "stop experiment after 10 sec" and this resulted in the same below error.
exp_stop_self.txt

Process Process-3:
Traceback (most recent call last):
  File "c:\fly-vr\flyvr\control\experiment.py", line 265, in new_from_python_file
    exp = getattr(mod, 'experiment')
AttributeError: 'NoneType' object has no attribute 'experiment'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\murthylab\miniconda3\envs\flyvr\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\murthylab\miniconda3\envs\flyvr\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "c:\fly-vr\flyvr\fictrac\fictrac_driver.py", line 109, in run
    setup_experiment(options)
  File "c:\fly-vr\flyvr\common\build_arg_parser.py", line 181, in setup_experiment
    _experiment_obj = Experiment.new_from_python_file(options.experiment_file)
  File "c:\fly-vr\flyvr\control\experiment.py", line 270, in new_from_python_file
    raise RuntimeError('experiment python file must define single variable of type Experiment')
RuntimeError: experiment python file must define single variable of type Experiment

also - just to make sure i wasn't going crazy - I also ran an audiovisual set (audiovisual playlist and randomization in experiment.py file) from yesterday and this worked...

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

Calling Experiment.stop() isn't going to work, I wrote that just to unambiguously convey the function name. It's not a class or static method so it's self.stop()

Strange that the bug seems not reliably reproducible.

from fly-vr.

nzjrs avatar nzjrs commented on July 28, 2024

Oh and it also could be that RuntimeError: experiment python file must.... is the error that gets printed if there is a syntax error or exception in or before __init__()

Easiest way to check for syntax errors is from memory, just to run the experiment.py aka $ python experiment.py - I'm pretty sure it will no-op but at least the interpreter checks the syntax.

from fly-vr.

mwangq avatar mwangq commented on July 28, 2024

ah! thanks for the suggestion. yeah there was an extra space creating an indent issues. got self.stop( ) to work. thanks so much!

from fly-vr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.