seanclaude / Redistricting

QGIS Plugin containing tools for electoral delimitation
GNU General Public License v2.0
2 stars 0 forks source link

Crash when number of parliamentary seats greater than state seats #1

Open seanlinmt opened 8 years ago

seanlinmt commented 8 years ago

Python errors:

An error has occured while executing Python code: Traceback (most recent call last): File "C:/Users/user/.qgis2/python/plugins\Redistricting\redistricting_dock.py", line 297, in live_show self.lb_recommendation.setText(balancer.recommendation_by_par(str(current_par))) File "C:/Users/user/.qgis2/python/plugins\Redistricting\balancer.py", line 378, in recommendation_by_par dun_size_with_min_seats = float(voters_par) / seats_state_min ZeroDivisionError: float division by zero

Python version: 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version: 2.6.1-Brighton Brighton, e2a51df

Python path: ['C:/PROGRA~2/QGISBR~1/apps/qgis/./python/plugins\processing', 'C:/Program Files (x86)/JetBrains/PyCharm 3.4.1/pycharm-debug.egg', 'C:/PROGRA~2/QGISBR~1/apps/qgis/./python', u'C:/Users/user/.qgis2/python', u'C:/Users/user/.qgis2/python/plugins', 'C:/PROGRA~2/QGISBR~1/apps/qgis/./python/plugins', 'C:\PROGRA~2\QGISBR~1\bin\python27.zip', 'C:\PROGRA~2\QGISBR~1\apps\Python27\DLLs', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\plat-win', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~2\QGISBR~1\bin', 'C:\PROGRA~2\QGISBR~1\apps\Python27', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win32.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\pytz-2014.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\Users\user.qgis2\python\plugins\MetaSearch\ext-libs', 'C:/Users/user/.qgis2/python/plugins\Redistricting\packages', 'C:\PROGRA~2\QGISBR~1\apps\qgis\python\plugins\fTools\tools', 'C:/Users/user/Desktop/QGIS Training/09 KL']

When I select new map: An error has occured while executing Python code: Traceback (most recent call last): File "C:/Users/user/.qgis2/python/plugins\Redistricting\redistricting_dock.py", line 297, in live_show self.lb_recommendation.setText(balancer.recommendation_by_par(str(current_par))) File "C:/Users/user/.qgis2/python/plugins\Redistricting\balancer.py", line 378, in recommendation_by_par dun_size_with_min_seats = float(voters_par) / seats_state_min ZeroDivisionError: float division by zero

Python version: 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version: 2.6.1-Brighton Brighton, e2a51df

Python path: ['C:/PROGRA~2/QGISBR~1/apps/qgis/./python/plugins\processing', 'C:/Program Files (x86)/JetBrains/PyCharm 3.4.1/pycharm-debug.egg', 'C:/PROGRA~2/QGISBR~1/apps/qgis/./python', u'C:/Users/user/.qgis2/python', u'C:/Users/user/.qgis2/python/plugins', 'C:/PROGRA~2/QGISBR~1/apps/qgis/./python/plugins', 'C:\PROGRA~2\QGISBR~1\bin\python27.zip', 'C:\PROGRA~2\QGISBR~1\apps\Python27\DLLs', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\plat-win', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~2\QGISBR~1\bin', 'C:\PROGRA~2\QGISBR~1\apps\Python27', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win32.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\pytz-2014.2-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg', 'C:\PROGRA~2\QGISBR~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\Users\user.qgis2\python\plugins\MetaSearch\ext-libs', 'C:/Users/user/.qgis2/python/plugins\Redistricting\packages', 'C:\PROGRA~2\QGISBR~1\apps\qgis\python\plugins\fTools\tools', 'C:/Users/user/Desktop/QGIS Training/09 KL']

PYWONG commented 8 years ago

I keyed in the data field of 123/00/04 as follows: PAR_Baru = KL05, DUN_BARU = N001. Python error still active

seanlinmt commented 8 years ago

It looks like the plugin is unable to handle the scenario where the number of parliamentary seats is greater than the number of state seats.

PYWONG commented 8 years ago

Sean,

The interim solution is to allow the no. of DUN to equal the PAR. This was what I did when I was working out the PBT electorate count.

Eg Set PBT 1 as PAR 1, DUN 1. PBT 2 as PAR 2, DUN 2.

Regards,

PY Wong

On Wed, Sep 23, 2015 at 11:34 PM, Sean Lin notifications@github.com wrote:

It looks like the plugin is unable to handle the scenario where the number of parliamentary seats is greater than the number of state seats.

— Reply to this email directly or view it on GitHub https://github.com/seanclaude/Redistricting/issues/1#issuecomment-142641225 .

adchin69 commented 8 years ago

The basic distribution of seats is that 2 to 4 state seats, = 1 parliament seat. Hope this helps.

Rgds Adrian

Sent using CloudMagic Email [https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.3.5&pv=4.4.2&source=email_footer_2] On Thu, Sep 24, 2015 at 8:27 AM, PYWONG < notifications@github.com [notifications@github.com] > wrote: Sean,

The interim solution is to allow the no. of DUN to equal the PAR. This was what I did when I was working out the PBT electorate count.

Eg Set PBT 1 as PAR 1, DUN 1. PBT 2 as PAR 2, DUN 2.

Regards,

PY Wong

On Wed, Sep 23, 2015 at 11:34 PM, Sean Lin notifications@github.com wrote:

It looks like the plugin is unable to handle the scenario where the number of parliamentary seats is greater than the number of state seats.

— Reply to this email directly or view it on GitHub https://github.com/seanclaude/Redistricting/issues/1#issuecomment-142641225 .

— Reply to this email directly or view it on GitHub [https://github.com/seanclaude/Redistricting/issues/1#issuecomment-142767894] .[https://github.com/notifications/beacon/AK6DbjD4ZkId7kDgjMti2-o-0gRrfbQwks5o0zrbgaJpZM4F8zIP.gif]

seanlinmt commented 8 years ago

Yes. That was the normal assumption. Kuala Lumpur was an edge case that was not taken into account.