Wed 28 Aug 21:38:52 CEST 2024
This commit is contained in:
		
							parent
							
								
									2d9cb3d0fc
								
							
						
					
					
						commit
						951362803d
					
				
							
								
								
									
										120
									
								
								src/SimNDT/graphics/colormaps.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								src/SimNDT/graphics/colormaps.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,120 @@ | |||
| __author__ = 'Miguel' | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import  numpy as np | ||||
| import matplotlib.cm  as cm | ||||
| import glumpy | ||||
| 
 | ||||
| 
 | ||||
| def make_N_colors(cmap_name, N): | ||||
| 	cmap = cm.get_cmap(cmap_name, N) | ||||
| 	return cmap(np.arange(N))[:,:-1] | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| jet	= cm.jet(range(0,256)) | ||||
| r,g,b,a = jet[:,0], jet[:,1], jet[:,2],jet[:,3] | ||||
| value   = np.linspace(0.0,1.0,256, endpoint=True) | ||||
| 
 | ||||
| 
 | ||||
| CMAP_JET = glumpy.colormap.Colormap((value[0], (r[0],g[0],b[0])), | ||||
| 											(value[16], (r[16],g[16],b[16])), | ||||
| 											(value[32], (r[32],g[32],b[32])), | ||||
| 											(value[48], (r[48],g[48],b[48])), | ||||
| 											(value[64], (r[64],g[64],b[64])), | ||||
| 											(value[96], (r[96],g[96],b[96])), | ||||
| 											(value[112], (r[112],g[112],b[112])), | ||||
| 											(value[128], (r[128],g[128],b[128])), | ||||
| 											(value[144], (r[144],g[144],b[144])), | ||||
| 											(value[160], (r[160],g[160],b[160])), | ||||
| 											(value[176], (r[176],g[176],b[176])), | ||||
| 											(value[192], (r[192],g[192],b[192])), | ||||
| 											(value[208], (r[208],g[208],b[208])), | ||||
| 											(value[224], (r[224],g[224],b[224])), | ||||
| 											(value[240], (r[240],g[240],b[240])), | ||||
| 											(value[255], (r[255],g[255],b[255]))) | ||||
| 
 | ||||
| 
 | ||||
| jet	= cm.gray(range(0,256)) | ||||
| r,g,b,a = jet[:,0], jet[:,1], jet[:,2],jet[:,3] | ||||
| value   = np.linspace(0.0,1.0,256, endpoint=True) | ||||
| CMAP_GRAY = glumpy.colormap.Colormap((value[0], (r[0],g[0],b[0])), | ||||
| 											(value[16], (r[16],g[16],b[16])), | ||||
| 											(value[32], (r[32],g[32],b[32])), | ||||
| 											(value[48], (r[48],g[48],b[48])), | ||||
| 											(value[64], (r[64],g[64],b[64])), | ||||
| 											(value[96], (r[96],g[96],b[96])), | ||||
| 											(value[112], (r[112],g[112],b[112])), | ||||
| 											(value[128], (r[128],g[128],b[128])), | ||||
| 											(value[144], (r[144],g[144],b[144])), | ||||
| 											(value[160], (r[160],g[160],b[160])), | ||||
| 											(value[176], (r[176],g[176],b[176])), | ||||
| 											(value[192], (r[192],g[192],b[192])), | ||||
| 											(value[208], (r[208],g[208],b[208])), | ||||
| 											(value[224], (r[224],g[224],b[224])), | ||||
| 											(value[240], (r[240],g[240],b[240])), | ||||
| 											(value[255], (r[255],g[255],b[255])) ) | ||||
| 
 | ||||
| 
 | ||||
| CMAP_RAINBOW = glumpy.colormap.Colormap((value[0], (1.,1.,1.)), | ||||
| 												(value[16], (0.74603175,  0.84126984,  0.96825397)), | ||||
| 												(value[32], (0.47619048,  0.68253968,  0.92063492)), | ||||
| 												(value[40], (0.36507937,  0.58730159,  0.87301587 )), | ||||
| 												(value[48], (0.26984127,  0.46031746,  0.77777778)), | ||||
| 												(value[64], (0.0952381 ,  0.20634921,  0.6031746 )), | ||||
| 												(value[80], (0.06349206,  0.20634921,  0.50793651 )), | ||||
| 												(value[96], (0.19047619,  0.46031746,  0.50793651)), | ||||
| 												(value[112], (0.34920635,  0.68253968,  0.44444444)), | ||||
| 												(value[120], (0.50793651,  0.74603175,  0.34920635 )), | ||||
| 												(value[128], (0.66666667,  0.80952381,  0.26984127)), | ||||
| 												(value[144], (1.        ,  0.95238095,  0.07936508)), | ||||
| 												(value[160], (0.92063492,  0.74603175,  0.22222222)), | ||||
| 												(value[176], (0.84126984,  0.53968254,  0.36507937)), | ||||
| 												(value[180], ( 0.82539683,  0.49206349,  0.3968254 )), | ||||
| 												(value[192], (0.82539683,  0.47619048,  0.3015873)), | ||||
| 												(value[208], (0.80952381,  0.44444444,  0.15873016)), | ||||
| 												(value[220], (0.76190476,  0.3968254 ,  0.07936508 )), | ||||
| 												(value[224], (0.74603175,  0.34920635,  0.0952381)), | ||||
| 												(value[240], (0.65079365,  0.17460317,  0.0952381)), | ||||
| 												(value[255], (0.57142857,  0.04761905,  0.11111111)) ) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| from matplotlib.colors import LinearSegmentedColormap | ||||
| 
 | ||||
| 
 | ||||
| arcoiris =  ( (1.,1.,1.), | ||||
| 			  (0.74603175,  0.84126984,  0.96825397), | ||||
| 			  (0.47619048,  0.68253968,  0.92063492), | ||||
| 			  (0.36507937,  0.58730159,  0.87301587), | ||||
| 			  (0.26984127,  0.46031746,  0.77777778), | ||||
| 			  (0.0952381 ,  0.20634921,  0.6031746 ), | ||||
| 			  (0.06349206,  0.20634921,  0.50793651), | ||||
| 			  (0.19047619,  0.46031746,  0.50793651), | ||||
| 			  (0.34920635,  0.68253968,  0.44444444), | ||||
| 			  (0.50793651,  0.74603175,  0.34920635), | ||||
| 			  (0.66666667,  0.80952381,  0.26984127), | ||||
| 			  (1.        ,  0.95238095,  0.07936508), | ||||
| 			  (0.92063492,  0.74603175,  0.22222222), | ||||
| 			  (0.84126984,  0.53968254,  0.36507937), | ||||
| 			  (0.82539683,  0.49206349,  0.3968254 ), | ||||
| 			  (0.82539683,  0.47619048,  0.3015873 ), | ||||
| 			  (0.80952381,  0.44444444,  0.15873016), | ||||
| 			  (0.76190476,  0.3968254 ,  0.07936508), | ||||
| 			  (0.74603175,  0.34920635,  0.0952381 ), | ||||
| 			  (0.65079365,  0.17460317,  0.0952381 ), | ||||
| 			  (0.57142857,  0.04761905,  0.11111111) ) | ||||
| 
 | ||||
| cdict = {'red':arcoiris, | ||||
| 		 'green':arcoiris, | ||||
| 		  'blue':arcoiris | ||||
| 		} | ||||
| 
 | ||||
| cmap_arcoiris = LinearSegmentedColormap('my_colormap',cdict,256) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user