mirror of
				https://github.com/fjosw/pyerrors.git
				synced 2025-11-04 01:25:46 +01:00 
			
		
		
		
	Benchmarks added
This commit is contained in:
		
					parent
					
						
							
								8655fe2cd1
							
						
					
				
			
			
				commit
				
					
						b5f3dd6ac3
					
				
			
		
					 9 changed files with 58 additions and 1 deletions
				
			
		
							
								
								
									
										19
									
								
								tests/roots_test.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tests/roots_test.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
import numpy as np
 | 
			
		||||
import pyerrors as pe
 | 
			
		||||
import pytest
 | 
			
		||||
 | 
			
		||||
np.random.seed(0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_root_linear():
 | 
			
		||||
 | 
			
		||||
    def root_function(x, d):
 | 
			
		||||
        return x - d
 | 
			
		||||
 | 
			
		||||
    value = np.random.normal(0, 100)
 | 
			
		||||
    my_obs = pe.pseudo_Obs(value, 0.1, 't')
 | 
			
		||||
    my_root = pe.roots.find_root(my_obs, root_function)
 | 
			
		||||
 | 
			
		||||
    assert np.isclose(my_root.value, value)
 | 
			
		||||
    difference = my_obs - my_root
 | 
			
		||||
    assert difference.is_zero()
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue