Last active
December 27, 2015 19:29
-
-
Save richstoner/7376911 to your computer and use it in GitHub Desktop.
SFN 2013 poster footage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "SFN13-posterfootage" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "# Calculate total square footage of posters at SFN 2013\n# Rich Stoner @rmstoner\n\nimport numpy as np", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 16 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "#!/usr/bin/env python\n\nimport epub\nimport glob\nimport pprint\nimport sys\nimport re\n\n# download epubs from http://files.abstractsonline.com/SUPT/146/3236/SfN-2013_TSM.htm into /epubs/\n\nbooklist = glob.glob('./epubs/*.epub')\n\nprint booklist", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "['./epubs/PosterPresentations_Monday_epub.epub', './epubs/PosterPresentations_Saturday_epub.epub', './epubs/PosterPresentations_Tuesday_epub.epub', './epubs/PosterPresentations_Wednesday_epub.epub', './epubs/PostersPresentations_Sunday_epub.epub']\n" | |
} | |
], | |
"prompt_number": 17 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "def remove_html_tags(data):\n p = re.compile(r'<.*?>')\n return p.sub('', data)\n\ndef remove_extra_spaces(data):\n p = re.compile(r'\\s+')\n return p.sub(' ', data)\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 18 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "# find all of the posters in the epub \n\nposter_count = 0\nfor book in booklist:\n bookref = epub.open(book)\n \n day_count = 0\n \n for manifestval in bookref.opf.manifest.values():\n first = True\n if '.htm' in manifestval.href:\n # print manifestval.href\n \n if first:\n html_temp = bookref.read_item(bookref.get_item_by_href(manifestval.href))\n # first = False\n \n htlm2 = remove_html_tags(html_temp)\n # print htlm2\n \n import string\n byline = string.split(htlm2, '\\n')\n \n poster_dict = {}\n \n for line in byline:\n if 'Poster' == line:\n poster_count += 1\n day_count += 1\n poster_dict = {}\n new_post_start = True\n \n session = byline[byline.index(line)+2]\n location = byline[byline.index(line)+4] + ' ' + byline[byline.index(line)+5]\n time = byline[byline.index(line)+7] + ' ' + byline[byline.index(line)+8]\n progpost = byline[byline.index(line)+10] \n topic = byline[byline.index(line)+13] + ' - ' + byline[byline.index(line)+14]\n\n poster_dict['session'] = session\n poster_dict['location'] = location\n poster_dict['time'] = time\n poster_dict['progpost'] = progpost\n poster_dict['topic'] = topic\n \n print day_count\n \nprint(len(poster_dict.keys()))\n \t\t\t\t# print line", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "3116\n1486" | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "\n3121" | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "\n3272" | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "\n2957" | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "\n5\n" | |
} | |
], | |
"prompt_number": 19 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "print poster_count", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "13952\n" | |
} | |
], | |
"prompt_number": 20 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "# assuming 1 of every 100 widthdrawal their poster\nattendance_percent = 0.99\n\n# maximum square footage of each poster : 72\" x 48\" = 6' x 4' = 24 ft^2\nmax_square_footage = 24\n\n# assuming actual square footage is 75% of max\navg_space_percent = 0.75\n\navg_square_footage = max_square_footage * avg_space_percent\nprint avg_square_footage\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "18.0\n" | |
} | |
], | |
"prompt_number": 21 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "# calcs\n\nmaximum_footage = poster_count * max_square_footage\nmaximum_footage_with_expected_attend = maximum_footage * attendance_percent\nmaximum_footage_with_expected_attend_and_realistic_footprint = maximum_footage_with_expected_attend * avg_space_percent\n\nprint 'Maximal sqft: %d ft^2' % maximum_footage\nprint 'Maximal sqft, assuming 1%% withdrawal rate: %d ft^2' % maximum_footage_with_expected_attend\nprint 'Maximal sqft, assuming 1%% withdrawal and 18sqft/poster : %d ft^2' % maximum_footage_with_expected_attend_and_realistic_footprint", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "Maximal sqft: 334848 ft^2\nMaximal sqft, assuming 1% withdrawal rate: 331499 ft^2\nMaximal sqft, assuming 1% withdrawal and 18sqft/poster : 248624 ft^2\n" | |
} | |
], | |
"prompt_number": 22 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "### but then you realize that people re-use abstract board space =)\n\nmax_posters_per_session = 3272 / 2\nmax_square_footage_per_session = max_posters_per_session * max_square_footage\n\nprint 'Max board footage: %d' % (max_square_footage_per_session)\n\n# boo. =)", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": "Max board footage: 39264\n" | |
} | |
], | |
"prompt_number": 23 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 23 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment