mirror of
				https://github.com/fjosw/pyerrors.git
				synced 2025-11-04 01:25:46 +01:00 
			
		
		
		
	reverted idl storage to list, added simple test for irregular error
propagation
This commit is contained in:
		
					parent
					
						
							
								6cf478fb57
							
						
					
				
			
			
				commit
				
					
						8ceee688ec
					
				
			
		
					 2 changed files with 14 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -78,7 +78,7 @@ class Obs:
 | 
			
		|||
                    if len(dc) == 1:
 | 
			
		||||
                        self.idl[name] = range(idx[0], idx[-1] + dc[0], dc[0])
 | 
			
		||||
                    else:
 | 
			
		||||
                        self.idl[name] = np.array(idx)
 | 
			
		||||
                        self.idl[name] = list(idx)
 | 
			
		||||
                else:
 | 
			
		||||
                    raise Exception('incompatible type for idl[%s].' % (name))
 | 
			
		||||
        else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -276,6 +276,12 @@ def test_cobs():
 | 
			
		|||
        assert (other / my_cobs * my_cobs - other).is_zero()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_irregular_error_propagation():
 | 
			
		||||
    regular_obs = pe.Obs([np.random.rand(1000)], ['t'])
 | 
			
		||||
    irregular_obs = pe.Obs([np.random.rand(500)], ['t'], idl=[range(1, 1000, 2)])
 | 
			
		||||
    assert regular_obs == (regular_obs / irregular_obs) * irregular_obs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_gamma_method_irregular():
 | 
			
		||||
    N = 20000
 | 
			
		||||
    arr = np.random.normal(1, .2, size=N)
 | 
			
		||||
| 
						 | 
				
			
			@ -375,4 +381,3 @@ def test_covariance2_symmetry():
 | 
			
		|||
    cov_ba = pe.covariance2(a, test_obs1)
 | 
			
		||||
    assert np.abs(cov_ab - cov_ba) <= 10 * np.finfo(np.float64).eps
 | 
			
		||||
    assert np.abs(cov_ab) < test_obs1.dvalue * test_obs2.dvalue * (1 + 10 * np.finfo(np.float64).eps)
 | 
			
		||||
    
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue