Forum Replies Created
-
AuthorPosts
-
mat646Participant
Correction, I lied before (without realizing), following the steps above you SHOULD change something about the image referencing:
You should now refer to the stimuli as follows (like Jeremy pointed out also in this thread):
PennController( newImage("my image", "http://127.0.0.1:3000/server.py?resource=Image.png") .print() , newButton("continue", "Continue") .print() .wait() )
(127.0.0.1 refers to your local host and :3000 stands for port 3000)
mat646ParticipantThank you all! Came across this thread when I tried to figure out how to run locally, and wanted to share what worked for me in case anyone else runs into any problems or has no prior knowledge about running anything via a local server.
Instructions for computer with Windows 10 and zero knowledge about local servers:
Before running experiment locally:
– download (zipped folder of everything) IBEX here: https://github.com/addrummond/ibex
– unpack somewhere accessible on your computer (e.g. desktop)
– download your zipped ibexfarm/pcibexfarm experiment file structure
– replace sample files from IBEX with your experiment files (most important = experiment script from data_includes and data/html pages from chunck_includes)To use locally stored images/sounds follow Jeremy’s instructions (repeated here):
edit the file server.py in your experiment’s www folder and, below these two lines:if fname.endswith(".wav") or fname.endswith(".mp3") or fname.endswith("m4a"): continue
add
if fname.endswith(".png") or fname.endswith(".jpg") or fname.endswith(".bmp"): continue
And further down, replace this line:
start_response('200 OK', [('Content-Type', 'audio/mpeg'), ('Content-Length', stats.st_size)])
withif qs_hash['resource'][0].endswith(".wav") or qs_hash['resource'][0].endswith(".mp3") or qs_hash['resource'][0].endswith(".m4a"): start_response('200 OK', [('Content-Type', 'audio/mpeg'), ('Content-Length', stats.st_size)]) elif qs_hash['resource'][0].endswith(".png") or qs_hash['resource'][0].endswith(".jpg") or qs_hash['resource'][0].endswith(".bmp"): start_response('200 OK', [('Content-Type', 'image/*'), ('Content-Length', stats.st_size)])
–> I first got an indentation error that was fixed by copy-pasting the indentation of a prior if line (don’t know why, but worked)
Then you can place your image and audio files (though no OGG file) in the chunk_includes folder
–> I did not need to change anything about the referencing in my script.js so after changing the lines above I could just refer to the stimuli as follows:
PennController( newImage("my image", "Image.png") .print() , newButton("continue", "Continue") .print() .wait() )
Now to run experiment locally:
-make sure python 2.7 is installed on your computer
-open windows command prompt (cmd)
-change directories to the ‘www’ folder of your local version of Ibex
e.g.cd C:\Users\maxim\desktop\ibex-master\www
– open server (SimpleHttpserver)
python server.py
Now open your browser and go to:
http://localhost:3000/experiment.htmlYour experiment should run.
-
AuthorPosts