.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_create_egg.py: ============================= Create an egg ============================= An egg is made up of two primary pieces of data: `pres`, which are the words/stimuli that were presented to a subject and `rec`, which are the words/stimuli that were recalled by the subject. .. code-block:: python # Code source: Andrew Heusser # License: MIT import quail # generate some fake data presented = [{ 'item' : 'CAT', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'C', 'length' : 3 }, { 'item' : 'DOG', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'D', 'length' : 3 }, { 'item' : 'SHOE', 'category' : 'object', 'size' : 'smaller', 'starting letter' : 'S', 'length' : 4 }, { 'item' : 'HORSE', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'H', 'length' : 5 } ] recalled = [{ 'item' : 'HORSE', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'H', 'length' : 5 }, { 'item' : 'DOG', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'D', 'length' : 3 }, { 'item' : 'CAT', 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'C', 'length' : 3 } ] # set some custom distance functions dist_funcs = { 'category' : 'lambda a, b: int(a!=b)', 'size' : 'lambda a, b: int(a!=b)', 'starting letter' : 'lambda a, b: int(a!=b)', 'length' : 'lambda a, b: np.linalg.norm(np.subtract(a,b))' } egg = quail.Egg(pres=[presented], rec=[recalled], dist_funcs=dist_funcs) fegg = egg.analyze('lagcrp') fegg.plot() **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_create_egg.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: create_egg.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: create_egg.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_