Skip to content

Commit

Permalink
Customize the experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
suchow committed Sep 1, 2016
1 parent 1a11233 commit 5d460ed
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
14 changes: 7 additions & 7 deletions examples/iterated-drawing/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ mode = sandbox
auto_recruit = true

[HIT Configuration]
title = War of the Ghosts
description = Read a brief story and answer some questions about it.
amt_keywords = Psychology, reading, text
title = Draw a new version of the character
description = Look at some handwritten characters and create new ones.
amt_keywords = Psychology, drawing, images
base_payment = 1.00
lifetime = 24
duration = 0.1
us_only = true
approve_requirement = 95
contact_email_on_error = bartlett1932@mailinator.com
ad_group = War of the Ghosts
psiturk_keywords = ghosts
organization_name = Monsters University
contact_email_on_error = wallace-characters@mailinator.com
ad_group = Drawing
psiturk_keywords = drawing
organization_name = UC Berkeley
browser_exclude_rule = MSIE, mobile, tablet

[Database Parameters]
Expand Down
22 changes: 9 additions & 13 deletions examples/iterated-drawing/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import base64


class Bartlett1932(Experiment):
class IteratedDrawing(Experiment):
"""Define the structure of the experiment."""

def __init__(self, session):
Expand All @@ -18,7 +18,7 @@ def __init__(self, session):
A few properties are then overwritten.
Finally, setup() is called.
"""
super(Bartlett1932, self).__init__(session)
super(IteratedDrawing, self).__init__(session)
self.experiment_repeats = 1
self.setup()

Expand All @@ -31,13 +31,13 @@ def setup(self):
source to each network.
"""
if not self.networks():
super(Bartlett1932, self).setup()
super(IteratedDrawing, self).setup()
for net in self.networks():
WarOfTheGhostsSource(network=net)
CharacterSource(network=net)

def create_network(self):
"""Return a new network."""
return Chain(max_size=3)
return Chain(max_size=11)

def add_node_to_network(self, node, network):
"""Add node to the chain and receive transmissions."""
Expand All @@ -54,18 +54,15 @@ def recruit(self):
self.recruiter().close_recruitment()


class WarOfTheGhostsSource(Source):
"""A Source that reads in a random story from a file and transmits it."""
class CharacterSource(Source):
"""Transmit handwritten characters from a local folder."""

__mapper_args__ = {
"polymorphic_identity": "war_of_the_ghosts_source"
"polymorphic_identity": "character_source"
}

def _contents(self):
"""Define the contents of new Infos.
transmit() -> _what() -> create_information() -> _contents().
"""
"""Read in the images."""
img_root = "static/images/characters"
filenames = os.listdir(img_root)
random.shuffle(filenames)
Expand All @@ -80,7 +77,6 @@ def _contents(self):
"name": fn,
"image": "data:image/png;base64," + encoded,
"drawing": "",
# "strokes": ,
})

return json.dumps(data)
4 changes: 2 additions & 2 deletions examples/iterated-drawing/templates/ad.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@

<h1>Call for participants</h1>
<p>
The XXX Lab at XXXXX University is looking for online participants
The CoCoSci Lab at UC Berkeley is looking for online participants
for a brief psychology experiment. The only requirements
are that you are at least 18 years old and are a fluent English
speaker. The task will take XXXXX minutes and will pay XXXXX.
speaker. The task will take 5 minutes and will pay $1.00.
</p>
<p>
Please click the "Accept HIT" button on the Amazon site
Expand Down

Large diffs are not rendered by default.

0 comments on commit 5d460ed

Please sign in to comment.