Skip to content
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

Issue/86/desc revision #91

Merged
merged 97 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
a8b45a9
updated figure
aimalz Aug 23, 2017
8205a4a
minor updates
aimalz Aug 23, 2017
b2b33c9
removed unnecessary requirements
aimalz Aug 23, 2017
25c384e
now calculating moments
aimalz Aug 23, 2017
2d81122
including more metrics with moments
aimalz Aug 23, 2017
f8ecb38
almost got moments/modes plotting
aimalz Aug 24, 2017
0893061
stumped on silly i/o problem for plotting moments
aimalz Aug 24, 2017
637381a
now checking stats between datasets
aimalz Aug 24, 2017
49e386e
improved quantile interpolation
aimalz Aug 24, 2017
b4c4cba
made sampling much faster
aimalz Aug 25, 2017
5b8eb4f
faster sampling and quantization
aimalz Aug 25, 2017
b3d82df
removing detritus
aimalz Aug 25, 2017
e418e4c
periodic backup with new quantization
aimalz Aug 25, 2017
f8545a1
eliminated PDF.interpolator due to pickling error (also unnecessary)
aimalz Aug 25, 2017
af440fc
cleaning up
aimalz Aug 25, 2017
a64231b
cleaning up
aimalz Aug 25, 2017
ca90f0e
fixed some bugs for quantile interpolation
aimalz Aug 25, 2017
99b178a
apparently interpolation fails when numbers are tiny
aimalz Aug 26, 2017
2eec8e1
everything works now!
aimalz Aug 26, 2017
bf113e2
trying to make better plots
aimalz Aug 26, 2017
d5e2fdc
fixing up plots
aimalz Aug 26, 2017
64595a2
added try/except for quantization
aimalz Aug 28, 2017
0ba1227
fiddling with plots
aimalz Aug 28, 2017
4948b24
fiddling with plots
aimalz Aug 29, 2017
d186190
added actual requirements
aimalz Aug 29, 2017
8ed47c2
changing some print statements to be more useful
aimalz Aug 29, 2017
fb201de
debugging kld
aimalz Aug 29, 2017
4542fdd
debugging kld
aimalz Aug 29, 2017
53a7246
removing spurious file
aimalz Aug 29, 2017
9defbe0
fixed bug in kld grid
aimalz Aug 29, 2017
82a3792
periodic backup
aimalz Aug 30, 2017
39d2523
improving default plot
aimalz Aug 30, 2017
5256277
improving default plot
aimalz Aug 30, 2017
88e2574
improving default plot
aimalz Aug 30, 2017
10b4281
improving default plot
aimalz Aug 30, 2017
49d0229
improving default plot
aimalz Aug 30, 2017
01c9120
improving default plot
aimalz Aug 30, 2017
60d647f
improved demo plot
aimalz Aug 30, 2017
0314ee7
fixed mistake in location of figure
aimalz Aug 30, 2017
3b12e5e
new figure
aimalz Aug 30, 2017
de546d7
fixed formatting error
aimalz Aug 30, 2017
0d86e3b
fixed typo
aimalz Aug 30, 2017
4c19c3b
periodic update
aimalz Aug 30, 2017
64a6e1c
still fiddling with plots
aimalz Aug 30, 2017
58e22b5
improved quantile interpolation again
aimalz Aug 30, 2017
1dc09a2
more references
aimalz Aug 30, 2017
18ec89d
note to self
aimalz Aug 30, 2017
86e8d97
changes to appendix
aimalz Aug 30, 2017
5d75d17
fixing formatting issues
aimalz Aug 31, 2017
cc75568
periodic backup
aimalz Aug 31, 2017
140ea0d
fixed some plotting stuff, ready for a big run
aimalz Aug 31, 2017
264c6a5
new version of paper
aimalz Aug 31, 2017
da3670e
preparing for NERSC run
aimalz Aug 31, 2017
fc49433
made more efficient!
aimalz Sep 1, 2017
5b5cc9c
rearranged for easier combination of multiple runs
aimalz Sep 1, 2017
d5449f2
trying to make it faster, might have to revert if this does not work
aimalz Sep 1, 2017
586a6a0
now identifying when quantile interpolation is bogus, replacing with …
aimalz Sep 1, 2017
14cbb48
adding backup interpolators to debug errors from scipy.interpolate
aimalz Sep 1, 2017
47559b3
finally trying to get meaningful errors while multiprocessing
aimalz Sep 1, 2017
aaf8343
cleaning up
aimalz Sep 1, 2017
541d70d
improving error messages
aimalz Sep 1, 2017
53eadd1
editing error messages
aimalz Sep 1, 2017
fc2b1a3
forgot import statement
aimalz Sep 1, 2017
c2bdf94
moved saving metrics around so failed runs do not break everything
aimalz Sep 1, 2017
e861ae0
updating figures
aimalz Sep 5, 2017
fd2e995
updating figures
aimalz Sep 5, 2017
9b58d19
fixed typo
aimalz Sep 6, 2017
f0be42a
fiddling with exceptions
aimalz Sep 6, 2017
73a3a40
perfecting figures
aimalz Sep 6, 2017
90d6db9
perfecting figures
aimalz Sep 6, 2017
fcefeb7
still fiddling with interpolation
aimalz Sep 6, 2017
94f1445
fixed broken try/except and interpolation
aimalz Sep 6, 2017
1a7e7a8
updating notebooks that make figures
aimalz Sep 6, 2017
f5ba047
fiddling with plots
aimalz Sep 6, 2017
6b5bbf1
fixing figures
aimalz Sep 6, 2017
e593999
saving progress for the day
aimalz Sep 6, 2017
bebc129
fixing error messages
aimalz Sep 7, 2017
78e708e
found the KLD bug!
aimalz Sep 26, 2017
424bcd3
adding back kld to pdf attributes
aimalz Sep 26, 2017
6f41ee1
adding back kld to pdf attributes
aimalz Sep 26, 2017
3c9e378
adding back kld to pdf attributes
aimalz Sep 26, 2017
532859f
new plot for the paper!
aimalz Sep 26, 2017
fe55003
periodic backup
aimalz Sep 27, 2017
dab4150
debugging for NERSC
aimalz Sep 30, 2017
2232845
added latest figures
aimalz Oct 3, 2017
5d9a29c
lots of description in the results and discussion
aimalz Oct 4, 2017
8107e1f
updating analysis pipeline, hopefully for the last time
aimalz Oct 5, 2017
06ee783
updates to paper and figures
aimalz Oct 10, 2017
c36977a
completed the discussion, finally
aimalz Oct 11, 2017
11abce1
periodic backup of minor changes
aimalz Oct 12, 2017
f18f226
fixed a bug in import
aimalz Oct 19, 2017
5d93238
final update to paper, hopefully
aimalz Oct 26, 2017
01bbc38
almost finished with proofreading update
aimalz Oct 31, 2017
d6f1842
final changes!
aimalz Nov 1, 2017
e463768
minor changes all around
aimalz Nov 1, 2017
075ee20
resolving merge conflict
aimalz Nov 12, 2017
099a343
fixing bug
aimalz Nov 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/desc-0000-qp-photo-z_approximation/acknowledgments.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%
This is the text imported from \code{acknowledgments.tex}, and will be replaced by some standard LSST DESC boilerplate at some point.
%
%
%This is the text imported from \code{acknowledgments.tex}, and will be replaced by some standard LSST DESC boilerplate at some point.
%
8 changes: 4 additions & 4 deletions docs/desc-0000-qp-photo-z_approximation/authors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Lastname,Firstname,Authorname,AuthorType,Affiliation,Contribution,Email
Malz,Alex,A.I.~Malz,Contact,"Center for Cosmology and Particle Physics, New York University, 726 Broadway, New York, 10003","Initiated project, led development work.",[email protected]
Marshall,Phil,P.J.~Marshall,Contributor,"SLAC National Accelerator Laboratory, Menlo Park, CA 94025, USA","Advised on statistics, and project design and management.",[email protected]
Schmidt,Samuel,S.J.~Schmidt,Contributor,"Dept. of Physics, University of California, One Shields Ave., Davis, CA, 95616","Provided the lower quality data mock catalog.",[email protected]
Graham,Melissa,M.~Graham,Contributor,"University of Washington","Provided the higher quality data mock catalog.",[email protected]
DeRose,Joe,J.~DeRose,Contributor,"Stanford University","Contributed to the production of the lower quality data mock catalog.",[email protected]
Wechsler,Risa,R.~Wechsler,Contributor,"Stanford University","Contributed to the production of the lower quality data mock catalog.",[email protected]
Schmidt,Samuel,S.J.~Schmidt,Contributor,"Dept. of Physics, University of California, One Shields Ave., Davis, CA, 95616","Produced the PDFs for the fainter mock catalog.",[email protected]
Graham,Melissa,M.L.~Graham,Contributor,"Department of Astronomy, University of Washington, Box 351580 U.W., Seattle, WA 98195-1580","Produced the photometry and PDFs for the brighter mock catalog.",[email protected]
DeRose,Joe,J.~DeRose,Contributor,"Stanford University","Produced the photometry for the fainter mock catalog.",[email protected]
Wechsler,Risa,R.~Wechsler,Contributor,"Stanford University","Produced the photometry for the fainter mock catalog.",[email protected]
4 changes: 2 additions & 2 deletions docs/desc-0000-qp-photo-z_approximation/authors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
\affiliation{SLAC National Accelerator Laboratory, Menlo Park, CA 94025, USA}
\author{S.J.~Schmidt}
\affiliation{Dept. of Physics, University of California, One Shields Ave., Davis, CA, 95616}
\author{M.~Graham}
\affiliation{University of Washington}
\author{M.L.~Graham}
\affiliation{Department of Astronomy, University of Washington, Box 351580 U.W., Seattle, WA 98195-1580}
\author{J.~DeRose}
\affiliation{Stanford University}
\author{R.~Wechsler}
Expand Down
8 changes: 4 additions & 4 deletions docs/desc-0000-qp-photo-z_approximation/contributions.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Author contributions are listed below. \\
A.I.~Malz: Initiated project, led development work. \\
P.J.~Marshall: Advised on statistics, and project design and management. \\
S.J.~Schmidt: Provided the Optical dataset. \\
M.~Graham: Provided the Optical+IR dataset. \\
J.~DeRose: Contributed to the production of the Optical dataset. \\
R.~Wechsler: Contributed to the production of the Optical dataset. \\
S.J.~Schmidt: Produced the PDFs for the fainter mock catalog. \\
M.L.~Graham: Produced the photometry and PDFs for the brighter mock catalog. \\
J.~DeRose: Produced the photometry for the fainter mock catalog. \\
R.~Wechsler: Produced the photometry for the fainter mock catalog. \\
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
487 changes: 428 additions & 59 deletions docs/desc-0000-qp-photo-z_approximation/main.bib

Large diffs are not rendered by default.

1,392 changes: 876 additions & 516 deletions docs/desc-0000-qp-photo-z_approximation/main.tex

Large diffs are not rendered by default.

1,930 changes: 1,220 additions & 710 deletions docs/desc-0000-qp-photo-z_approximation/research/analysis.html

Large diffs are not rendered by default.

1,838 changes: 1,489 additions & 349 deletions docs/desc-0000-qp-photo-z_approximation/research/analysis.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
"outputs": [],
"source": [
"# choose one of these:\n",
"dataset_key = 'Euclid'# Melissa Graham's data\n",
"# dataset_key = 'LSST'# Sam Schmidt's data\n",
"# dataset_key = 'Euclid'# Melissa Graham's data\n",
"dataset_key = 'LSST'# Sam Schmidt's data\n",
"dataname = dataset_key\n",
"\n",
"dataset_info = {}\n",
Expand Down Expand Up @@ -192,24 +192,24 @@
},
"outputs": [],
"source": [
"colors = ['red','green','blue','cyan','magenta','yellow']\n",
"n_plot = len(colors)\n",
"\n",
"# if dataset_key == 'mg':\n",
"# indices = [1, 3, 14, 16, 19, 21]\n",
"# elif dataset_key == 'ss':\n",
"n_gals_tot = len(pdfs)\n",
"full_gal_range = range(n_gals_tot)\n",
"indices = np.random.choice(full_gal_range, n_plot)\n",
"\n",
"for i in range(n_plot):\n",
" plt.plot(dataset_info[dataset_key]['z_grid'], pdfs[indices[i]], \n",
" color=colors[i], label=dataset_key+'#'+str(indices[i]))\n",
"plt.xlabel(r'$z$', fontsize=16)\n",
"plt.ylabel(r'$p(z)$', fontsize=16)\n",
"plt.title(dataset_key+' mock catalog')\n",
"plt.legend()\n",
"plt.savefig('pz_placeholder_'+dataset_key+'.png', dpi=250)"
"# colors = ['red','green','blue','cyan','magenta','yellow']\n",
"# n_plot = len(colors)\n",
"\n",
"# # if dataset_key == 'mg':\n",
"# # indices = [1, 3, 14, 16, 19, 21]\n",
"# # elif dataset_key == 'ss':\n",
"# n_gals_tot = len(pdfs)\n",
"# full_gal_range = range(n_gals_tot)\n",
"# indices = np.random.choice(full_gal_range, n_plot)\n",
"\n",
"# for i in range(n_plot):\n",
"# plt.plot(dataset_info[dataset_key]['z_grid'], pdfs[indices[i]], \n",
"# color=colors[i], label=dataset_key+' #'+str(indices[i]))\n",
"# plt.xlabel(r'$z$', fontsize=16)\n",
"# plt.ylabel(r'$p(z)$', fontsize=16)\n",
"# plt.title(dataset_key+' mock catalog')\n",
"# plt.legend()\n",
"# plt.savefig('pz_placeholder_'+dataset_key+'.pdf', dpi=250)"
]
},
{
Expand Down Expand Up @@ -246,8 +246,10 @@
"if dataset_key == 'Euclid':\n",
" chosen = 5390\n",
"elif dataset_key == 'LSST':\n",
" chosen = 108019\n",
"\n",
"# chosen = 108019 \n",
" indices = [ 12543, 52661, 46216, 53296, 95524, 84574 , 2607 ,56017 , 64794, 7600]\n",
" chosen = indices[9]\n",
" \n",
"start_time = timeit.default_timer()\n",
"G = qp.PDF(gridded=(dataset_info[dataset_key]['z_grid'], pdfs[chosen]))\n",
"print(timeit.default_timer() - start_time)\n",
Expand All @@ -265,13 +267,13 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
"if dataset_key == 'Euclid':\n",
" nc_needed = 3\n",
"elif datanset_key == 'LSST':\n",
"elif dataset_key == 'LSST':\n",
" nc_needed = 5\n",
" \n",
"dataset_info[dataset_key]['N_GMM'] = nc_needed"
Expand Down Expand Up @@ -312,7 +314,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
Expand All @@ -332,24 +335,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The `qp.composite` object can be used as the `qp.PDF.truth` to initialize a new `qp.PDF` object that doesn't have any information about the gridded or sample approximations but has a qualitatively similar shape and is thus \"realistically complex\" enough to draw conclusions about real data. Now we can approximate it any way we like! Consider this example for $N_f=20$ parameters."
"The `qp.composite` object can be used as the `qp.PDF.truth` to initialize a new `qp.PDF` object that doesn't have any information about the gridded or sample approximations but has a qualitatively similar shape and is thus \"realistically complex\" enough to draw conclusions about real data. Now we can approximate it any way we like! Consider this example for $N_f=7$ parameters."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": false
"scrolled": true
},
"outputs": [],
"source": [
"N_f = 20\n",
"N_f = 7\n",
"M = qp.PDF(truth=G.mix_mod, limits=dataset_info[dataset_key]['z_lim'])\n",
"M.quantize(N=N_f, vb=False)\n",
"M.histogramize(N=N_f, binrange=dataset_info[dataset_key]['z_lim'], vb=False)\n",
"M.sample(N=N_f, using='truth', vb=False)\n",
"M.plot(loc=dataset_key+'_example_pz.png', vb=True)"
"M.plot(loc=dataset_key+'_example_pz.pdf', vb=True)"
]
},
{
Expand Down Expand Up @@ -407,7 +410,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
Expand All @@ -424,7 +427,7 @@
"\n",
"if dataset_key == 'Euclid':\n",
" dataset_info[dataset_key]['N_GMM'] = 3\n",
"elif datanset_key == 'LSST':\n",
"elif dataset_key == 'LSST':\n",
" dataset_info[dataset_key]['N_GMM'] = 5\n",
"fit_components = dataset_info[dataset_key]['N_GMM']\n",
"\n",
Expand Down Expand Up @@ -485,7 +488,7 @@
" N_pdfs =len(pdfs)\n",
" randos = np.random.choice(range(N_pdfs), n_plot)\n",
" for i in range(n_plot):\n",
" plt.plot(z_grid, pdfs[randos[i]], label=dataset_key+'#'+str(randos[i]))\n",
" plt.plot(z_grid, pdfs[randos[i]], label=dataset_key+r'\\#'+str(randos[i]))\n",
" plt.xlabel(r'$z$', fontsize=16)\n",
" plt.ylabel(r'$p(z)$', fontsize=16)\n",
" plt.title(dataset_key+' mock catalog')\n",
Expand Down Expand Up @@ -1657,14 +1660,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
Expand Down
34 changes: 20 additions & 14 deletions docs/notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
},
"outputs": [],
"source": [
"print P.approximate([0.314], using='quantiles')"
"print P.approximate(np.array([0.314]), using='quantiles')"
]
},
{
Expand Down Expand Up @@ -227,7 +227,7 @@
"outputs": [],
"source": [
"print P.scheme\n",
"print P.approximate([0.314], using='quantiles', scheme='nearest')\n",
"print P.approximate(np.array([0.314]), using='quantiles', scheme='nearest')\n",
"print P.scheme"
]
},
Expand Down Expand Up @@ -373,23 +373,29 @@
},
"outputs": [],
"source": [
"qD1 = qp.utils.calculate_kl_divergence(P, Q, limits=(-5.,5.), vb=True)\n",
"qD1 = qp.utils.calculate_kl_divergence(P, Q, limits=(-1.,1.), vb=True)\n",
"qD2 = qp.utils.calculate_kl_divergence(P, Q, limits=(-2.,2.), vb=True)\n",
"qD3 = qp.utils.calculate_kl_divergence(P, Q, limits=(-3.,3.), vb=True)\n",
"\n",
"hD1 = qp.utils.calculate_kl_divergence(P, H, limits=(-5.,5.), vb=True)\n",
"print 'Quantile approximation: KLD over 1,2,3 sigma ranges = ', qD1, qD2, qD3\n",
"hD1 = qp.utils.calculate_kl_divergence(P, H, limits=(-1.,1.), vb=True)\n",
"hD2 = qp.utils.calculate_kl_divergence(P, H, limits=(-2.,2.), vb=True)\n",
"hD3 = qp.utils.calculate_kl_divergence(P, H, limits=(-3.,3.), vb=True)\n",
"\n",
"sD1 = qp.utils.calculate_kl_divergence(P, S, limits=(-5.,5.), vb=True)\n",
"print 'Histogram approximation: KLD over 1,2,3 sigma ranges = ', hD1, hD2, hD3\n",
"sD1 = qp.utils.calculate_kl_divergence(P, S, limits=(-1.,1.), vb=True)\n",
"sD2 = qp.utils.calculate_kl_divergence(P, S, limits=(-2.,2.), vb=True)\n",
"sD3 = qp.utils.calculate_kl_divergence(P, S, limits=(-3.,3.), vb=True)\n",
"\n",
"print 'Quantile approximation: KLD over 1,2,3 sigma ranges = ', qD1, qD2, qD3\n",
"print 'Histogram approximation: KLD over 1,2,3 sigma ranges = ', hD1, hD2, hD3\n",
"print 'Sampled approximation: KLD over 1,2,3 sigma ranges = ', sD1, sD2, sD3"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"Holy smokes, does the quantile approximation blow everything else out of the water, thanks to using spline interpolation."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -563,7 +569,7 @@
"outputs": [],
"source": [
"Cs = qp.PDF(truth=C_dist, limits = composite_lims)\n",
"Cs.sample(N=20, vb=False)\n",
"Cs.sample(N=20, using='truth', vb=False)\n",
"Cs.plot()"
]
},
Expand Down Expand Up @@ -609,14 +615,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
Expand Down
Loading