Skip to content

Commit

Permalink
synthpop not popsynth!
Browse files Browse the repository at this point in the history
  • Loading branch information
fscottfoti authored and jiffyclub committed Aug 29, 2014
1 parent 046ab5f commit 269304b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions demos/synthesize.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:586b98c2fc7380d32660f6c473ca941f12e24098bf557b68b8cf28544446b61a"
"signature": "sha256:de940336e38f3edd9fae8000c40fa6ee561943d377b8340f482eb9d2b6acbf23"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand All @@ -14,7 +14,7 @@
"input": [
"from popgen.recipes.starter import marginals_and_joint_distributions\n",
"from popgen.census_helpers import Census\n",
"from popgen.synthesizer import PopSynth\n",
"from popgen.synthesizer import SynthPop\n",
"import os\n",
"import time"
],
Expand All @@ -28,7 +28,7 @@
"collapsed": false,
"input": [
"c = Census(os.environ[\"CENSUS\"])\n",
"ps = PopSynth(c)"
"sp = SynthPop(c)"
],
"language": "python",
"metadata": {},
Expand All @@ -40,7 +40,7 @@
"collapsed": false,
"input": [
"print time.ctime()\n",
"ps.synthesize(*marginals_and_joint_distributions(c, \"CA\", \"Napa County\"))\n",
"sp.synthesize(*marginals_and_joint_distributions(c, \"CA\", \"Napa County\"))\n",
"print time.ctime()"
],
"language": "python",
Expand Down
4 changes: 1 addition & 3 deletions popgen/synthesizer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from popgen.ipf import ipf


class PopSynth:
class SynthPop:

def __init__(self, c):
self.c = c
Expand All @@ -21,7 +21,6 @@ def synthesize(self, h_marg, p_marg, h_jd, p_jd):
index[tract_ind])
s, _ = ipf.calculate_constraints(row, h_jd.loc[puma])
h_weights.append(s)
print len(h_weights)

# running ipf for population
p_weights = []
Expand All @@ -31,4 +30,3 @@ def synthesize(self, h_marg, p_marg, h_jd, p_jd):
index[tract_ind])
s, _ = ipf.calculate_constraints(row, p_jd.loc[puma])
p_weights.append(s)
print len(p_weights)

0 comments on commit 269304b

Please sign in to comment.