smoh / gaia-comoving-stars

Finding wide binaries from the ESA Gaia mission

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

let there be only one frame of indicies?

smoh opened this issue · comments

@adrn Right now, you cutoff stacked tgas catalog with a S/N cut in line 39 of generate-par-sample.py, and indicies generated from this file is for that particular S/N cut applied tgas, and we need to give compute-likelihood-ratio.py that same S/N. I think this is quite prone to mistakes... and it's better to only refer to indicies in the entire tgas catalog. This may be an issue when we pass info to @timothydmorton also. Let me know what you think.

@smoh You're absolutely right, I just couldn't figure out an easy way to do that without doing way more calculations than I needed.

My suggested changes in one-indicies branch -- I think that should get it done.
I didn't merge it because there's something else going on.

In master or one-indicies, I get the following for either random or nearest neighbor pairs.

projects/gaia-wide-binaries [master●] » python scripts/compute-likelihood-ratio.py -v --tgas-file ~/data/gaia/tgas_source/stacked_tgas.fits --pairs-file snr8_n32_dv4.fits --snr-cut 8
DEBUG: Using pool: <class 'schwimmbad.serial.SerialPool'> [__main__]
/Users/semyeong/anaconda2/lib/python2.7/site-packages/numpy/core/numeric.py:301: FutureWarning: in the future, full(3, 0) will return an array of dtype('int64')
  format(shape, fill_value, array(fill_value).dtype), FutureWarning)
y [-22.77243541  -2.92362517   0.        ]
M [[-0.12409192 -0.99227073  0.        ]
 [ 0.98235497 -0.12285187  0.14101818]
 [-0.13992821  0.01749922  0.99000701]]
Cinv [[ 0.61678859 -0.03455493  0.        ]
 [-0.03455493  0.44979569  0.        ]
 [ 0.          0.          0.        ]] [ 0.          0.44292787  0.6236564 ]
Vinv [[ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]] [ 0.  0.  0.]
Ainv [[ 0.45198487  0.05481973  0.06291484]
 [ 0.05481973  0.60565471 -0.00295721]
 [ 0.06291484 -0.00295721  0.00894469]] [  3.67544536e-17   4.42927871e-01   6.23656402e-01]
Traceback (most recent call last):
  File "scripts/compute-likelihood-ratio.py", line 151, in <module>
    seed=args.seed, overwrite=args.overwrite)
  File "scripts/compute-likelihood-ratio.py", line 89, in main
    pool.map(worker, all_pairs, callback=worker.callback)
  File "build/bdist.macosx-10.6-x86_64/egg/schwimmbad/serial.py", line 33, in map
  File "scripts/compute-likelihood-ratio.py", line 33, in __call__
    return self.work(i, star1, star2, v_scatter)
  File "scripts/compute-likelihood-ratio.py", line 28, in work
    n_dist_samples=self.n_distance_samples)
  File "/Users/semyeong/projects/gaia-wide-binaries/gwb/fml.py", line 85, in ln_H2_FML
    for d1,d2 in zip(dist1, dist2)])
  File "/Users/semyeong/projects/gaia-wide-binaries/gwb/likelihood.py", line 142, in ln_H2_marg_v_likelihood
    return (ln_Q(d1, data1, Vinv, v_scatter) + ln_Q(d2, data2, Vinv, v_scatter))
  File "/Users/semyeong/projects/gaia-wide-binaries/gwb/likelihood.py", line 139, in ln_Q
    return _marg_likelihood_helper(d, data, Vinv, v_scatter)
  File "/Users/semyeong/projects/gaia-wide-binaries/gwb/likelihood.py", line 130, in _marg_likelihood_helper
    assert sgn > 0
AssertionError

nvm..Vinv is zero because integer division happend in line 50 I think.

will consider this done. guess you'll probably add from __future__ import division.

Unless you already merged, can you file a PR from your branch to master so we can review there?

sorry, it's merged, and pushed.