-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor code to support custom calculators #283
Conversation
|
||
for key, v in contacts_per_coord.items(): | ||
x, y = key | ||
color = color_scale(1.0 - v * 1.0 / max_contacts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential divide by zero exception here if max_contacts
is not updated in if
block at line# 344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually correct. If max_contacts is zero, this means there was no contact which in turn means contacts_per_coord will be empty and therefore the loop will not be executed.
* added error message * Refactor to support custom calculator-part1 (#278) * Change policy submodule name to schedulers * Rename daily_schedule.py to schedule.py * Update index.js Removed console log statement. * Refactor code to support custom schedulers (#281) * Change policy submodule name to schedulers * Rename daily_schedule.py to schedule.py * create new OfficeScheduler and EmployeeSchedule classes * Rename employee schedule to office schedule * Rename MeetingPolicy to MeetingSchedule. Add missing docstrings. * Update unit tests and fix failing tests * Fix linting issues * No more circular imports...yay! * Update tests and fix issues from review * Remove unnecessary exception * Fix linting issues * Refactor code to support custom calculators (#283) * Change policy submodule name to schedulers * Rename daily_schedule.py to schedule.py * create new OfficeScheduler and EmployeeSchedule classes * Rename employee schedule to office schedule * Rename MeetingPolicy to MeetingSchedule. Add missing docstrings. * Update unit tests and fix failing tests * Fix linting issues * No more circular imports...yay! * Update tests and fix issues from review * Remove unnecessary exception * Fix linting issues * Move close contacts computation to custom calculator class * Update simulation unit tests * Update close contacts unit tests * Fix contacts per coord unit test * Fix linting issues * Fix broken unit tests * Fix linting issues * delete package-lock.json * added Policy info to home page * Update the Simulation class to support custom applications (#286) * Update simulation class to support custom calculator and scheduler * Fix linting issues * redesined ui - pending load trajectory * load trajectory on button click * code cleanup * updated css layout * Update footer for copyright year * Fix bug with issue loader showing up when sim changes. * Fix doc link and update policy details automatically * Remove unnecessary vue files * Reload trajectory and map data when new simulation is selected. * Fix double scrollbar issue * Fix map sizing and remove old test files * Revert "Fix map sizing and remove old test files" This reverts commit b86ae1b. * Remove unnecessary js tests * Add passWithNoTests to JS tests. * Check black's version and output diffs * Fix black issues + line sizing in map * Output vue version used for linting * Check vue version before linting * Update vue-cli version in package.json * Remove check for vue version * Check eslint version * Remove check for eslint version * Fix js linting issue (finally!) * Updated docs for release/0.15 (#292) * Add full example simulation and simplify README * Look in current directory for facility data * Remove manual ToC * Remove obsolete info * Reformat files with black * Reformat files with black - part2 It seems black changed their formatting rules in their new version. Pretty much all the python files are reformatted. * Fix python linting * Stop tracking package-lock.json * Updated copyright & simpler install from source Co-authored-by: Amit Jha <JhaA2@corning.com> Co-authored-by: Modini <ModiniK@corning.com> Co-authored-by: amjha <amitjha@usc.edu>
Extract all close contacts calculations from main Simulation class into a custom calculator class. Support the usage of any custom user-provided calculator that subclasses a new abstract Calculator class.