mirror of
				https://github.com/fjosw/pyerrors.git
				synced 2025-11-04 09:35:45 +01:00 
			
		
		
		
	refactor: unnecessary keywords for call to numdifftools removed, test
against numerical differentiation made stricter.
This commit is contained in:
		
					parent
					
						
							
								a97d0c31a6
							
						
					
				
			
			
				commit
				
					
						6971e8cd9b
					
				
			
		
					 2 changed files with 2 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -1123,14 +1123,7 @@ def derived_observable(func, data, array_mode=False, **kwargs):
 | 
			
		|||
            raise Exception('Multi mode currently not supported for numerical derivative')
 | 
			
		||||
        options = {
 | 
			
		||||
            'base_step': 0.1,
 | 
			
		||||
            'step_ratio': 2.5,
 | 
			
		||||
            'num_steps': None,
 | 
			
		||||
            'step_nom': None,
 | 
			
		||||
            'offset': None,
 | 
			
		||||
            'num_extrap': None,
 | 
			
		||||
            'use_exact_steps': None,
 | 
			
		||||
            'check_num_steps': None,
 | 
			
		||||
            'scale': None}
 | 
			
		||||
            'step_ratio': 2.5}
 | 
			
		||||
        for key in options.keys():
 | 
			
		||||
            kwarg = kwargs.get(key)
 | 
			
		||||
            if kwarg is not None:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -304,7 +304,7 @@ def test_derived_observables():
 | 
			
		|||
    d_Obs_fd = pe.derived_observable(lambda x, **kwargs: x[0] * x[1] * np.sin(x[0] * x[1]), [test_obs, test_obs], num_grad=True)
 | 
			
		||||
    d_Obs_fd.gamma_method()
 | 
			
		||||
 | 
			
		||||
    assert d_Obs_ad.value == d_Obs_fd.value
 | 
			
		||||
    assert d_Obs_ad == d_Obs_fd
 | 
			
		||||
    assert np.abs(4.0 * np.sin(4.0) - d_Obs_ad.value) < 1000 * np.finfo(np.float64).eps * np.abs(d_Obs_ad.value)
 | 
			
		||||
    assert np.abs(d_Obs_ad.dvalue-d_Obs_fd.dvalue) < 1000 * np.finfo(np.float64).eps * d_Obs_ad.dvalue
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue