Showing posts with label Erin Sheldon. Show all posts
Showing posts with label Erin Sheldon. Show all posts

Thursday, November 3, 2011

Talk at Brookhaven

Yesterday I gave the first research seminar of my life. It was a 50 minute talk at Brookhaven National Labs. Overall, I think it went well. The talk was to a small group of research scientists. About half were cosmologists, the other half were physicists of another flavor.

My hosts Erin Sheldon and Anže Slosar gave me some really helpful feed back:
  1. I wasn't expecting such a mixed audience, and I didn't give enough introduction to BOSS, and the data. For instance I didn't directly discuss why quasars are hard to target. I also didn't emphasize that the inputs to the likelihood were the photometric fluxes. I should have talked more about the difference between photometric and spectroscopic data. But in general, I need to be more aware of the audience and beef up the introduction.
  2. I went through the full derivation of the likelihood, and this wasn't necessary.
  3. I was nervous and relied on notecards. Anže said this made it look like I didn't understand what I was talking about. Basically, I need to practice the talk a bunch so I don't need cards.
  4. I mispoke and talked about the first BAO detection. I said it was from SDSS-II, it was actually from SDSS-I.
  5. In general I didn't feel prepared to answer all questions, I need to go through the talk and make sure I fully understand everything I am posting -- for instance how was the first BAO detection made?
The talk was more fun than I expected, and has definitely eased my nerves in terms of my quals. I think I can use a similar version of this talk for my quals, which is good.

Friday, June 18, 2010

Princeton Progress

We have some confusing findings from this week. First of all, I re-ran the reconstruction on a smaller angular scale (as both Alexia and Erin told me to do as I was going out to way to large of scales) and got the following for the angular correlation functions:

Close up on a few:

This concerns Alexia and me because first of all they are almost featureless on this degree scale (they look really flat). Second, they seem to move in the wrong direction as a function of redshift bin. We would expect that as we go out further in redshift, the same angular separation would correspond to larger physical separation of objects, and thus the angular correlation should decrease as redshift increases (see below), but we are seeing the opposite.

From Connolly et al. arXiv:astro-ph/0107417v2

Here are the 3D correlation functions:

Here are the photometric and spectroscopic redshift distributions

And the best fit reconstruction, which isn't very good
And I am still getting problems with changing the binning dramatically influencing the reconstruction.

List of things to do:
1. Run my angular correlation function on the same data set as in this paper, and see if I get the same solution.
2. Alexia is running the reconstruction on her data sets to see if she gets the same strange behavior for the correlation functions as a function of redshift.
3. Alexia is going to play with the binning and see if she gets the same strange behavior.
4. I need to come up with another way to do the reconstruction that doesn't involve this lambda/tolerance but minimizes the ximat...


Monday, May 17, 2010

ALL the Quasars Results

I've calculated the thresholds using the method outlined in this post.

Below are the lratio thresholds for the old version of the likelihood (v1) and the likelihood with ALL the Quasars as a function of targets per square degree (TPSD):

TPSD ----- v1 threshold - all quasar threshold
10.0000 ----- 0.996883 ----- 0.984691
20.0000 ----- 0.868663 ----- 0.795943
30.0000 ----- 0.674674 ----- 0.629976
40.0000 ----- 0.496851 ----- 0.522806
50.0000 ----- 0.403819 ----- 0.441149
60.0000 ----- 0.318171 ----- 0.363089
70.0000 ----- 0.262071 ----- 0.310237
80.0000 ----- 0.215056 ----- 0.268664

Here's a plot
Cyan is the ALL the Quasars
Green is likelihood v1


Using these thresholds here are the number of quasars targeted:
TPSD ---- #QSOs (v1) --- #QSOs (ALL quasars)
10.0000 -- 132.000 ----- 155.000
20.0000 -- 343.000 ----- 374.000
30.0000 -- 484.000 ----- 527.000
40.0000 -- 651.000 ----- 638.000
50.0000 -- 731.000 ----- 713.000
60.0000 -- 815.000 ----- 793.000
70.0000 -- 888.000 ----- 853.000
80.0000 -- 944.000 ----- 889.000

Here's a plot
Cyan is the ALL the Quasars
Green is likelihood v1


Next, I'll look at the difference between these QSO populations, but first I want Adam/Erin to confirm that I am doing things correctly.

The code to do this is in the following log file: ../logs/100517log.pro

Monday, May 10, 2010

Setting Thresholds

I've made a file to use for setting the thresholds. It is objects in Erin's median seeing file (../boss/boss-qso-stripe82median.fits) that are in the following ra/dec ranges:

(-1 < dec ≤ 1) and
(0 < ra ≤ 1) or (20 < ra ≤ 21) or (40 < ra ≤ 41) or
(320 < ra ≤ 321) or (340 < ra ≤ 341) or (359 ≤ ra < 360)

The area of this file is 2 (degrees in dec) × 6 (degrees in ra) = 12 deg2.
The number of targets in this file 43,134.

Ra/Dec of Threshold Targets
<

I modified the likelihood.script to take as an argument the directory to store the likefile*.fits. So now when you run the likelihood.script you do the following:
./likelihood.script thisrundirectory

This will stores all the likefile*.fits and qsub*.out files in the directory ../likelihood/thisrundirectory

If you don't give the likelihood.script a directory argument it will write in the current directory.

I have found a problem that not all the Stripe-82 quasars in the 3pc catalog are in Erin's median seeing targets catalog. I've pinged him about this. We'll see if he has an idea.

In the mean time, I am determining the thresholds for the old version of the likelihood (v1) on my set of threshold targets above. I'm also re-calculating the likelihoods on the 3pc quasars which I have median seeing for to make sure I get the same numbers again.

The code for this is here: ../logs/100510log.pro
The run directory is here: ../likelihood/likev1

Thursday, April 8, 2010

Changing 3D Correlation Function

One of my "things to think about" from yesterday's blog post was to make changes to the 3D correlation function so that it was truly an auto-correlation (only having one set of randoms which should speed up the calculation by a bit).

I made changes to my 3D correlation function to do this (at least I think I have) and I am running a test to see if I get the same solution as when I have two separate random catalogs (what I was doing) and also to see how much this speeds things up.

This set of runs in in the working directory: ../pythonjess/run201048_1527 and the log file where the code to run this is ../logs/100408log.py.

The new version runs in 7 seconds, whereas before it took 20 seconds! So that is a good improvement.

Here is a plot to show they look the same


Buzz Comments from Erin about qsub and splitting up the jobs:

Erin Sheldon - Have you used the PBS system on riemann? You can submit jobs and they get sent to different machines on the system. You could split your random runs into 25 different jobs, run them in parallel on 25 different machines, and then just add up the counts later.

That's a factor of n_machines speedup, better than you could every hope to get by just writing faster code.

Below is a sample script, let's call it test.pbs. You can submit with "qsub test.pbs". Of course change all the log file paths to make sense for you.
Erin

#PBS -l nodes=1:ppn=1
#PBS -l walltime=24:00:00
#PBS -q batch
#PBS -N this_job_name
#PBS -j oe
#PBS -o /path/to/where/the/pbs/script/is/test.pbs.pbslog
#PBS -m a
#PBS -V
#PBS -r n
#PBS -W umask=0022

# put setups here

setup numpy -r ~esheldon/exports/numpy-trunk
setup scipy -r ~esheldon/exports/scipy-trunk
setup esutil -r ~esheldon/exports/esutil-trunk
setup python -r ~esheldon/exports/python/2.6.4

# this log is different than above, you can
# watch it in real time
logfile=/path/to/where/the/pbs/script/is/test.pbs.log

# send commands to python
python &> "$logfile" <6:49 am
DeleteUndo deleteReport spamNot spam

Erin Sheldon - oh, and to see the status of your jobs
qstat -n -1 -u your_user_name

or equivalently:
~esheldon/python/bin/pbswatch
6:55 am

Wednesday, April 7, 2010

Speeding-up the Correlation Function

I ran another comparison between Sheldon's and my correlation function on a larger data set. Erin had suggested that I play with the depth (this is something to do with the grid spacing of his function). Below is an email from him:

So the default depth of the tree is depth=10. It seems that a lower depth, and thus lower resolution, is better for these very large 10-degree search angles. Here are some timing numbers that show depth=6 is best. You would do this to set your depth:

h=esutil.htm.HTM(depth)

depth seconds
3 137.153673172
4 114.97971487
5 104.600896835

6 99.5818519592

7 102.73042202

8 119.931453943

9 185.077499866

10 460.641659021

11 1502.35429096


Erin also thinks I am correlating out to too large of an angle. Alexia did a quick calculation and agrees with this assessment. This is another reason why my correlation functions are taking so long. Erin suggests that I try working in physical space (Mpc) instead of angular space:

Another thing to try is working in physical space. 10 degrees is definitely too large in angle. If you are, for example, willing to work at 30Mpc you could get big speedups. You know the redshifts of the spectroscopic sample of course. So you just bin in physical projected separation as defined by:
d*angle

where d is the angular diameter distance in Mpc and angle is in radians. The bincount function is set up to do this. If you send the scale= keyword then the rmin,rmax arguments will be in units of the scale*angle.


Let's say you have the spectroscopic sample.
ra1, dec1, z1 And the second sample is the photometric sample. ra2,dec2

# you can also give omega_m etc. here, see docs
cosmo = esutil.cosmology.Cosmo()

# get angular diameter distance
# to points in set 1
d = cosmo.Da(0.0, z1)

rmin = 0.025 # Note units in Mpc
rmax = 30 # Mpc
nbin = 25

rlower,rupper,counts = h.bincount(rmin,rmax,nbin,ra1,dec1,ra2,dec2,scale=d)

Now rlower,rupper are also in Mpc.

I did a bigger run on 356,915 objects out to 10 degrees, here are the numbers:

For Erin's
Start time = 12:59:24.71
End time = 13:32:24.96
Run time = 1980.25 seconds ≈ 33 minutes

For Mine
Start time = 12:57:33.83
End time = 13:40:35.13
Run time = 2581.30 seconds ≈ 43 minutes

A few things to think about:
  • Should I change the correlation angle as a function of the spectroscopic redshift? Can the reconstruction handle this?
  • I am currently running the DD, DR, RD, RR correlations all in succession, but they could be run simultaneously and this could in theory speed up the calculation.
  • What are the correct angles and comoving distances I should be correlating out to? Obviously going out to 20 degrees is too much. Alexia's quick calculations estimates that I only need to go out to 6 degrees, but this varies with redshift.
  • Sheldon's code does run faster and has more functionality. Should I use it from now on?
  • The 3D correlation function is always an auto-correlation function, and so there is no need to calculate both DR and RD and so I could change this code to run faster by calculating the correlation as DD - 2DR + RR. Of course RR is going to be 25X more points that DD and 5X as DR (I am over sampling by 5) so most the time of the calculation is spent there.
Plot


Happy Birthday Toni and Cleo

Tuesday, April 6, 2010

Comparing Correlation Function

I ran a simple experiment to compare Erin Sheldon's correlation function and mine/Alexia's. I modified my correlation function so that it was only calculating the data-data pair counts. I did the same with Erin's. I did this on a set of 53,071 objects. I did an auto-correlation for simplicity (both data sets were the same).

For Erin's
Start time = 16:01:53:98
End time = 16:09:11:49
Run time = 437.51 seconds

For Mine
Start time = 16:24:27:99
End time = 16:26:12:03
Run time = 104.04 seconds

The number of pair counts match pretty well, except for at the ends which I believe is just a binning effect:



I'm kind of confused why my correlation function is 4X faster on this data set, when ball-park numbers Erin and I were comparing before implied that his should run much faster. I am going to see if maybe they scale differently with number of points by running on a larger data set.

Monday, April 5, 2010

Sheldon's Correlaton Function

Erin Sheldon is helping me with my 2D correlation function. He has one that runs a lot faster than the one I have been using. He has been amazing in helping me to get it working with my data set.

After some incompatibility problems with various packages we needed for running our respective code it seems to be able working now (well it compiles and passes the checks). However, when I try to run it I get the following error:

RuntimeError: found log_binsize < 0

I've pinged Erin about this, so we'll see if he has ideas. The code I'm using to test this is in the following log file: .../logs/100405log.py

7:15 Update: Erin Rocks! He just got back to me with a fix. It is running now! I'm going to do some tests to see how long it takes and compare it's answer with my correlation function's answer.

Outputs:
Generating HTM ids
Generating reverse indices
rmin: 0.001
rmax: 10
degrees?: True
nbin: 25
logrmin: -3
logrmax: 1
log binsize: 0.16
len(scale_array) = 0

Each dot is 500 points
......................................................................
35000/53071 pair count: 176696860
....................................

In [15]: rlower
Out[15]:
array([ 1.00000000e-03, 1.44543977e-03, 2.08929613e-03,
3.01995172e-03, 4.36515832e-03, 6.30957344e-03,
9.12010839e-03, 1.31825674e-02, 1.90546072e-02,
2.75422870e-02, 3.98107171e-02, 5.75439937e-02,
8.31763771e-02, 1.20226443e-01, 1.73780083e-01,
2.51188643e-01, 3.63078055e-01, 5.24807460e-01,
7.58577575e-01, 1.09647820e+00, 1.58489319e+00,
2.29086765e+00, 3.31131121e+00, 4.78630092e+00,
6.91830971e+00])

In [16]: rupper
Out[16]:
array([ 1.44543977e-03, 2.08929613e-03, 3.01995172e-03,
4.36515832e-03, 6.30957344e-03, 9.12010839e-03,
1.31825674e-02, 1.90546072e-02, 2.75422870e-02,
3.98107171e-02, 5.75439937e-02, 8.31763771e-02,
1.20226443e-01, 1.73780083e-01, 2.51188643e-01,
3.63078055e-01, 5.24807460e-01, 7.58577575e-01,
1.09647820e+00, 1.58489319e+00, 2.29086765e+00,
3.31131121e+00, 4.78630092e+00, 6.91830971e+00,
1.00000000e+01])

In [17]: counts
Out[17]:
array([ 468, 512, 758, 1216, 2176, 4266,
6962, 13332, 25388, 46232, 83912, 146620,
246088, 377354, 523490, 674092, 972164, 1683416,
3167032, 6144742, 12083396, 22744048, 41867790, 71782726,
105281816])

Monday, March 29, 2010

Data Run

I'm running the reconstruction on the data. I'm doing in the working directory: .../pythonJess/run2010329_1319. I am running this with 12 redshift bins and 250k photometric and spectroscopic objects.

I did a little bit of thinking about the number of grids for the correlation function. There is the strange balance that you want the number of grids to be less than the number of particles, otherwise you might as well just correlate all possible pairs. You also want the spacing to be much bigger than the max correlation length, otherwise even by going out one grid length, you will unnecessarily correlate too many objects. I feel like this is a computer science problem, and perhaps Adam Pauls or Erin Sheldon would know the answer?

I played with this a bit (tried upping the grid points to 1000, and this took forever to run). For the 2D correlation function, I am correlating out to a distance of 0.34 (with a box size of 1). Maybe I don't need to correlate out to such a big angle? We could probably have as few as 10 grid points in each dimension if we are going out to this large of an angle. For the 3D correlation function, I am correlating out to a distance of 20 Mpc/h (with a box size of 2400 Mpc/h) so we need at least ~120 grid points in each dimension.

For the 3D correlation function, some of the larger redshift bins have very few objects in them, and if we have ~1003 or 106 grid points then we are wasting time griding if we have less than 103 points in each set.

Here are the results from the reconstruction I ran yesterday. It looks like I don't have enough points because the correlation functions are very noisy.





The reconstructions don't look good and are highly variable:




I'm running on a bigger data set now.

Wednesday, March 10, 2010

Tips for VI

The connection between riemann and the hotel in Utah is really slow, so I've been using VI to edit code remotely. I rarely use it, but thought it would be useful to have some notes of the few commands that I have been using while they are fresh in my mind.

Opening file - vi filename
Start editing file - i (for insert)
Stop editing file - esc
Save file - :w (write)
Quit file - :q
Save and quit file - :wq

From Erin Sheldon, the vi mug from think geek:

Wednesday, March 3, 2010

Single Epoch vs Coadded

Joe Hennawi asked me to give him targeting files that were single epoch versus coadded for Stripe 82. Erin Sheldon had created some files for me which had different seeings:

This is the standard primary on stripe 82:
http://data.sdss3.org/sas/bosswork/groups/boss/target/2009-12-05-chunk1-retrain/bosstarget-qso-2009-12-05-chunk1-retrain-collate-fullcache.fits

These are alternative runs on stripe 82:
"good seeing"
http://data.sdss3.org/sas/bosswork/groups/boss/target/2009-11-30-stripe82pairs/bosstarget-qso-2009-11-30-stripe82pairs-collate-good-fullcache.fits

"median seeing"
http://data.sdss3.org/sas/bosswork/groups/boss/target/2009-11-30-stripe82pairs/bosstarget-qso-2009-11-30-stripe82pairs-collate-median-fullcache.fits

"bad seeing"
http://data.sdss3.org/sas/bosswork/groups/boss/target/2009-11-30-stripe82pairs/bosstarget-qso-2009-11-30-stripe82pairs-collate-bad-fullcache.fits

And it matched them to the variable catalogs (co-adds) with the following code:

erinfile2 = '/home/jessica/boss/boss-qso-stripe82median.fits'
confTT = mrdfits(erinfile2, 2)

varcat0 = '/home/schlegel/varcat4/varcat-ra0-30.fits.gz'
varcat = mrdfits(varcat0, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch0 = confTT[i1]
varmatch0 = varcat[i2]

varcat1 = '/home/schlegel/varcat4/varcat-ra30-60.fits.gz'
varcat = mrdfits(varcat1, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch1 = confTT[i1]
varmatch1 = varcat[i2]

varcat2 = '/home/schlegel/varcat4/varcat-ra60-90.fits.gz'
varcat = mrdfits(varcat2, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch2 = confTT[i1]
varmatch2 = varcat[i2]

varcat3 = '/home/schlegel/varcat4/varcat-ra90-120.fits.gz'
varcat = mrdfits(varcat3, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch3 = confTT[i1]
varmatch3 = varcat[i2]

varcat4 = '/home/schlegel/varcat4/varcat-ra300-330.fits.gz'
varcat = mrdfits(varcat4, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch4 = confTT[i1]
varmatch4 = varcat[i2]

varcat5 = '/home/schlegel/varcat4/varcat-ra330-360.fits.gz'
varcat = mrdfits(varcat5, 1)
spherematch, confTT.ra, confTT.dec, varcat.ra, varcat.dec, 2./3600, i1, i2, d12
truthmatch5 = confTT[i1]
varmatch5 = varcat[i2]

truthmatch = [truthmatch0, truthmatch1, truthmatch4, truthmatch5]
varmatch = [varmatch0, varmatch1, varmatch4, varmatch5]

outfile = "./singleEpochMatch.fits"
splog, 'Writing file ', outfile
mwrfits, truthmatch, outfile, /create

outfile = "./coaddedMatch.fits"
splog, 'Writing file ', outfile
mwrfits, varmatch, outfile, /create

This creates two matched catalogs, each with 735,498 objects in Stripe-82. I'm sending these files to Jo and Joe to help with the "extreme deconvolution." (Man I love that name)