Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Dec 27, 2024
1 parent 0e8bfee commit b089e15
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
1 change: 1 addition & 0 deletions tests/test_nnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def check_arrays(nnn):
np.testing.assert_equal(nnn.v.shape, (nnn.nbins, nnn.nubins, 2*nnn.nvbins) )
np.testing.assert_almost_equal(nnn.v[0,0,:], nnn.v1d)
np.testing.assert_almost_equal(nnn.v[-1,-1,:], nnn.v1d)
assert nnn._zetas == []

def check_defaultuv(nnn):
assert nnn.min_u == 0.
Expand Down
13 changes: 5 additions & 8 deletions treecorr/corr3base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,11 +2321,10 @@ def _sum(self, others):
np.sum([c.weighti for c in others], axis=0, out=self.weighti)
np.sum([c.ntri for c in others], axis=0, out=self.ntri)

def _calculate_varzeta(self, vz, i1=0, i2=None):
if vz is None:
vz = np.zeros(self.data_shape)
if self._var_num != 0:
vz.ravel()[:] = self.cov_diag[i1:i2].real
def _calculate_varzeta(self, i1=0, i2=None):
vz = np.zeros(self.data_shape)
if self._var_num != 0:
vz.ravel()[:] = self.cov_diag[i1:i2].real
return vz

def toSAS(self, *, target=None, **kwargs):
Expand Down Expand Up @@ -2376,6 +2375,7 @@ def toSAS(self, *, target=None, **kwargs):
sas.npatch3 = self.npatch3
sas.coords = self.coords
sas.metric = self.metric
sas._var_num = self._var_num

# Use nominal for meanphi
sas.meanu[:] = sas.phi / sas._phi_units
Expand Down Expand Up @@ -2416,9 +2416,6 @@ def toSAS(self, *, target=None, **kwargs):

sas.results[k] = temp

if hasattr(self, '_var_num'):
sas._var_num = self._var_num

if self._z[0].size == 0:
# NNN doesn't have a zeta to compute
return sas
Expand Down
8 changes: 4 additions & 4 deletions treecorr/gggcorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,25 @@ def finalize(self, varg1, varg2, varg3):
@property
def vargam0(self):
if self._vargam0 is None:
self._vargam0 = self._calculate_varzeta(self._vargam0, 0, self._nbins)
self._vargam0 = self._calculate_varzeta(0, self._nbins)
return self._vargam0

@property
def vargam1(self):
if self._vargam1 is None:
self._vargam1 = self._calculate_varzeta(self._vargam1, self._nbins, 2*self._nbins)
self._vargam1 = self._calculate_varzeta(self._nbins, 2*self._nbins)
return self._vargam1

@property
def vargam2(self):
if self._vargam2 is None:
self._vargam2 = self._calculate_varzeta(self._vargam2, 2*self._nbins, 3*self._nbins)
self._vargam2 = self._calculate_varzeta(2*self._nbins, 3*self._nbins)
return self._vargam2

@property
def vargam3(self):
if self._vargam3 is None:
self._vargam3 = self._calculate_varzeta(self._vargam3, 3*self._nbins, 4*self._nbins)
self._vargam3 = self._calculate_varzeta(3*self._nbins, 4*self._nbins)
return self._vargam3

def _clear(self):
Expand Down
6 changes: 3 additions & 3 deletions treecorr/kkgcorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def finalize(self, vark1, vark2, varg):
@property
def varzeta(self):
if self._varzeta is None:
self._varzeta = self._calculate_varzeta(self._varzeta)
self._varzeta = self._calculate_varzeta()
return self._varzeta

def _clear(self):
Expand Down Expand Up @@ -247,7 +247,7 @@ def finalize(self, vark1, varg, vark2):
@property
def varzeta(self):
if self._varzeta is None:
self._varzeta = self._calculate_varzeta(self._varzeta)
self._varzeta = self._calculate_varzeta()
return self._varzeta

def _clear(self):
Expand Down Expand Up @@ -376,7 +376,7 @@ def finalize(self, varg, vark1, vark2):
@property
def varzeta(self):
if self._varzeta is None:
self._varzeta = self._calculate_varzeta(self._varzeta)
self._varzeta = self._calculate_varzeta()
return self._varzeta

def _clear(self):
Expand Down
2 changes: 1 addition & 1 deletion treecorr/kkkcorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def finalize(self, vark1, vark2, vark3):
@property
def varzeta(self):
if self._varzeta is None:
self._varzeta = self._calculate_varzeta(self._varzeta)
self._varzeta = self._calculate_varzeta()
return self._varzeta

def _clear(self):
Expand Down

0 comments on commit b089e15

Please sign in to comment.