Warnings should reference their caller
This commit is contained in:
		
							parent
							
								
									893d8bcb15
								
							
						
					
					
						commit
						24d012fccc
					
				| @ -229,7 +229,7 @@ class Grid(object): | |||||||
|         self.exyz = [numpy.unique(pixel_edge_coordinates[i]) for i in range(3)] |         self.exyz = [numpy.unique(pixel_edge_coordinates[i]) for i in range(3)] | ||||||
|         for i in range(3): |         for i in range(3): | ||||||
|             if len(self.exyz[i]) != len(pixel_edge_coordinates[i]): |             if len(self.exyz[i]) != len(pixel_edge_coordinates[i]): | ||||||
|                 warnings.warn('Dimension {} had duplicate edge coordinates'.format(i)) |                 warnings.warn('Dimension {} had duplicate edge coordinates'.format(i), stacklevel=2) | ||||||
| 
 | 
 | ||||||
|         if is_scalar(periodic): |         if is_scalar(periodic): | ||||||
|             periodic = [periodic] * 3 |             periodic = [periodic] * 3 | ||||||
| @ -248,7 +248,7 @@ class Grid(object): | |||||||
| 
 | 
 | ||||||
|         if (self.shifts < 0).any(): |         if (self.shifts < 0).any(): | ||||||
|             # TODO: Test negative shifts |             # TODO: Test negative shifts | ||||||
|             warnings.warn('Negative shifts are still experimental and mostly untested, be careful!') |             warnings.warn('Negative shifts are still experimental and mostly untested, be careful!', stacklevel=2) | ||||||
| 
 | 
 | ||||||
|         num_shifts = self.shifts.shape[0] |         num_shifts = self.shifts.shape[0] | ||||||
|         if num_grids is None: |         if num_grids is None: | ||||||
| @ -259,7 +259,7 @@ class Grid(object): | |||||||
|         grids_shape = hstack((num_grids, self.shape)) |         grids_shape = hstack((num_grids, self.shape)) | ||||||
|         if is_scalar(initial): |         if is_scalar(initial): | ||||||
|             if isinstance(initial, int): |             if isinstance(initial, int): | ||||||
|                 warnings.warn('Initial value is an int, grids will be integer-typed!') |                 warnings.warn('Initial value is an int, grids will be integer-typed!', stacklevel=2) | ||||||
|             self.grids = numpy.full(grids_shape, initial) |             self.grids = numpy.full(grids_shape, initial) | ||||||
|         else: |         else: | ||||||
|             if len(initial) < num_grids: |             if len(initial) < num_grids: | ||||||
| @ -270,7 +270,7 @@ class Grid(object): | |||||||
|                 if is_scalar(initial[i]): |                 if is_scalar(initial[i]): | ||||||
|                     if initial[i] is not None: |                     if initial[i] is not None: | ||||||
|                         if isinstance(initial[i], int): |                         if isinstance(initial[i], int): | ||||||
|                             warnings.warn('Initial value is an int, grid {} will be integer-typed!'.format(i)) |                             warnings.warn('Initial value is an int, grid {} will be integer-typed!'.format(i), stacklevel=2) | ||||||
|                         self.grids[i] = numpy.full(self.shape, initial[i]) |                         self.grids[i] = numpy.full(self.shape, initial[i]) | ||||||
|                 else: |                 else: | ||||||
|                     if not numpy.array_equal(initial[i].shape, self.shape): |                     if not numpy.array_equal(initial[i].shape, self.shape): | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user