- Timestamp:
- Aug 16, 2019, 11:06:08 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2694 r2698 193 193 # oper_submatrix: Function to perform an operation of a given matrix along a sub-set of values along its dimensions 194 194 # operations: Function to perform different operations to a pair of matrices of values 195 # pastel_deccolor: Transforming a decimal color to a 'pastel' tone 195 196 # period_information_360d: Function to provide the information of a given period idate, edate (dates in 196 197 # [YYYY][MM][DD][HH][MI][SS] format) in a 360 years calendar … … 16936 16937 return area, areakm 16937 16938 16939 def pastel_deccolor(color, pdeg=0.8): 16940 """ Transforming a decimal color to a 'pastel' tone 16941 color: decimal color ([0,1.], [0,1.], [0,1.]) 16942 pdeg: degree of 'pastel' (0.8, default) 16943 >>> pastel_deccolor([1.,0.,0.]) 16944 [ 1. 0.8 0.8] 16945 >>> pastel_deccolor([1.,0.5,0.3]) 16946 [ 1. 0.4 0.56] 16947 """ 16948 fname = 'pastel_deccolor' 16949 16950 pastelc = np.array(color) 16951 16952 # Looking for the maximum 16953 cmax = np.max(pastelc) 16954 16955 # Increasing any, except cmax up to 0.8cmax 16956 pastelc = np.where(pastelc != cmax, (1.-pastelc)*0.8*cmax, pastelc) 16957 16958 return pastelc 16959 16938 16960 #quit() 16939 16961
Note: See TracChangeset
for help on using the changeset viewer.