diff --git a/.gitignore b/.gitignore index 8e7e8b85ec393e4a36ca51d4fef008181303e9e7..dd833d9e8e6e3baa958a74016574a50c10786f56 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,20 @@ build/ # ignore python files #*.pyc +# ignore pdfs +*.pdf + +#ignore log +*.log + +# ignore vts +*.vts +*.vtu + +# ignore png +*.png + + #ignore kdevelop files *.kdev4 diff --git a/src/1-ParameterFamily_G+_Flat.py b/src/1-ParameterFamily_G+_Flat.py new file mode 100644 index 0000000000000000000000000000000000000000..3c17616257af70505fc1b718e9b86478abb07c63 --- /dev/null +++ b/src/1-ParameterFamily_G+_Flat.py @@ -0,0 +1,1111 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +import seaborn as sns +import matplotlib.colors as mcolors + +from chart_studio import plotly +import plotly.graph_objs as go +import plotly.express as px +import plotly.colors +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def show(fig): + import io + import plotly.io as pio + from PIL import Image + buf = io.BytesIO() + pio.write_image(fig, buf) + img = Image.open(buf) + img.show() + + + + +def add_arrow(line, position=None, direction='right', size=15, color=None): + """ + add an arrow to a line. + + line: Line2D object + position: x-position of the arrow. If None, mean of xdata is taken + direction: 'left' or 'right' + size: size of the arrow in fontsize points + color: if None, line color is taken. + """ + if color is None: + color = line.get_color() + + xdata = line.get_xdata() + ydata = line.get_ydata() + + if position is None: + position = xdata.mean() + # find closest index + start_ind = np.argmin(np.absolute(xdata - position)) + if direction == 'right': + end_ind = start_ind + 1 + else: + end_ind = start_ind - 1 + + line.axes.annotate('', + xytext=(xdata[start_ind], ydata[start_ind]), + xy=(xdata[end_ind], ydata[end_ind]), + arrowprops=dict(arrowstyle="->", color=color), + size=size + ) + + +# set the colormap and centre the colorbar +class MidpointNormalize(mcolors.Normalize): + """ + Normalise the colorbar so that diverging bars work there way either side from a prescribed midpoint value) + + e.g. im=ax1.imshow(array, norm=MidpointNormalize(midpoint=0.,vmin=-100, vmax=100)) + """ + def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): + self.midpoint = midpoint + mcolors.Normalize.__init__(self, vmin, vmax, clip) + + def __call__(self, value, clip=None): + # I'm ignoring masked values and all kinds of edge cases to make a + # simple example... + x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] + return np.ma.masked_array(np.interp(value, x, y), np.isnan(value)) + + + +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + + +def format_func(value, tick_number): + # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == -1: + # return r"$-\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + ##find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == -1: + return r"$-\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N == -2: + return r"$-\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +def energy(a1,a2,q1,q2,q12,q3,b1,b2): + + + a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + tmp = H.dot(a) + + # print('H',H) + # print('A',A) + # print('b',b) + # print('a',a) + # print('tmp',tmp) + + tmp = (1/2)*a.dot(tmp) + # print('tmp',tmp) + + tmp2 = A.dot(b) + # print('tmp2',tmp2) + tmp2 = 2*a.dot(tmp2) + + # print('tmp2',tmp2) + energy = tmp - tmp2 + # print('energy',energy) + + + # energy_axial1.append(energy_1) + + return energy + + + +# def energy(a1,a2,q1,q2,q12,q3,b1,b2): +# +# +# b = np.array([b1,b2]) +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a',a) +# print('tmp',tmp) +# +# tmp = (1/2)*a.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a.dot(tmp2) +# +# print('tmp2',tmp2) +# energy = tmp - tmp2 +# print('energy',energy) +# +# +# # energy_axial1.append(energy_1) +# +# return energy +# + + + + + +################################################################################################################ +################################################################################################################ +################################################################################################################ + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') + +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# +# print('abar:',abar) +# +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# +# +# # print('abar:',np.shape(abar)) +# # print('np.transpose(abar):',np.shape(np.transpose(abar))) +# sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# # sstar = (1/(q1+q2))*abar.dot(tmp) +# print('sstar', sstar) +# abarperp= np.array([abar[1],-abar[0]]) +# print('abarperp:',abarperp) + + +# -------------------------- Input Parameters -------------------- + +mu1 = 1.0 +rho1 = 1.0 +alpha = 5.0 +theta = 1.0/2 +# theta= 0.1 +beta = 5.0 + + + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = -0.75 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +#Figure3: +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/8 +# # theta= 0.1 +# beta = 2.0 + + +# alpha= -5 + + +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +gamma = '0' +# gamma = 'infinity' + + +lambda1 = 0.0 + + +print('---- Input parameters: -----') +print('mu1: ', mu1) +print('rho1: ', rho1) +# print('alpha: ', alpha) +print('beta: ', beta) +# print('theta: ', theta) +print('gamma:', gamma) + +print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- +print('----------------------------') + +# ---------------------------------------------------------------- + + + + + + +q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +q12 = 0.0 +q3 = GetMuGamma(beta, theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +b1 = prestrain_b1(rho1,beta, alpha, theta ) +b2 = prestrain_b2(rho1,beta, alpha, theta ) + + +## ---- 1-ParameterFamilyCase: +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# print('abar:',abar) +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# b1=b[0] +# b2=b[1] +## --------------- + + + + + +######################################## + +# 1-ParameterFamilyCase: + +q1=1; +q2=2; +q12=1/2; +q3=((4*q1*q2)**0.5-q12)/2; +# H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + +H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +abar = np.array([q12+2*q3, 2*q2]) +abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + +print('abar:',abar) + +b = np.linalg.lstsq(A, abar)[0] +print('b',b) + +b1=b[0] +b2=b[1] + + +##---------------------- +print('q1 = ', q1) +print('q2 = ', q2) +print('q3 = ', q3) +print('q12 = ', q12) +print('b1 = ', b1) +print('b2 = ', b2) +##-------------- + + +# print('abar:',np.shape(abar)) +# print('np.transpose(abar):',np.shape(np.transpose(abar))) +sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# sstar = (1/(q1+q2))*abar.dot(tmp) +print('sstar', sstar) +abarperp= np.array([abar[1],-abar[0]]) +print('abarperp:',abarperp) + +print('sstar*abar:', sstar*abar) +# print('np.dot(sstar*abar):', np.dot(sstar*abar)) +print('----------------------------') + + +N=1000; +# N=10; +scale_domain = 5 + +translate_startpoint = -1.8 + +T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) +# T = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) +# T = np.linspace(-2,2, num=N) +# print('T:', T) + +print('T.min():', T.min()) +print('T.max():', T.max()) + +kappas = [] +alphas = [] +# G.append(float(s[0])) + +G_container = [] +abar_container = [] + +test = sstar*abar + + +abar_tmp = abar + +for t in T : + abar_current = sstar*abar+t*abarperp; + # abar_current[abar_current < 1e-10] = 0 # Projection onto x-y-axis!! + print('abar_current', abar_current) + G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] + G_container.append(G) + abar_container.append(abar_current) + e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] + kappa = abar_current[0]+abar_current[1] + alpha = math.atan2(e[1], e[0]) + # print('angle current:', alpha) + kappas.append(kappa) + alphas.append(alpha) + + +alphas = np.array(alphas) +kappas = np.array(kappas) + +# print('G_container', G_container) +G = np.array(G_container) +abar = np.array(abar_container) + +print('G', G) +print('abar', abar) +print('abar.shape',abar.shape) + + + + + + + + + + +###################################### + + + +num_Points = 400 +num_Points = 200 +# num_Points = 20 + + +# Creating dataset +x = np.linspace(-5,5,num_Points) +y = np.linspace(-5,5,num_Points) + +x = np.linspace(-20,20,num_Points) +y = np.linspace(-20,20,num_Points) + + +x = np.linspace(-2,2,num_Points) +y = np.linspace(-2,2,num_Points) + +# x = np.linspace(-10,10,num_Points) +# y = np.linspace(-10,10,num_Points) + +# x = np.linspace(-60,60,num_Points) +# y = np.linspace(-60,60,num_Points) +# +# +# x = np.linspace(-40,40,num_Points) +# y = np.linspace(-40,40,num_Points) + + +a1, a2 = np.meshgrid(x,y) + +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) + +ContourRange=20 + +x_in = np.linspace(-ContourRange,ContourRange,num_Points) +y_in = np.linspace(-ContourRange,ContourRange,num_Points) +a1_in, a2_in = np.meshgrid(x_in,y_in) + +print('a1:', a1) +print('a2:',a2 ) + +print('a1.shape', a1.shape) + +#-- FILTER OUT VALUES for G+ : + +# tmp1 = a1[np.where(a1*a2 >= 0)] +# tmp2 = a2[np.where(a1*a2 >= 0)] +# +# np.take(a, np.where(a>100)[0], axis=0) +# tmp1 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = a2[np.where(a1*a2 >= 0)] + +tmp1 = a1[a1*a2 >= 0] +tmp2 = a2[a1*a2 >= 0] +tmp1 = tmp1.reshape(-1,5) +tmp2 = tmp2.reshape(-1,5) + + +# tmp1_pos = a1[np.where(a1*a2 >= 0) ] +# tmp2_pos = a2[np.where(a1*a2 >= 0) ] +# tmp1_pos = tmp1_pos[np.where(tmp1_pos >= 0)] +# tmp2_pos = tmp2_pos[np.where(tmp2_pos >= 0)] +# +# tmp1_neg = a1[a1*a2 >= 0 ] +# tmp2_neg = a2[a1*a2 >= 0 ] +# tmp1_neg = tmp1_neg[tmp1_neg < 0] +# tmp2_neg = tmp2_neg[tmp2_neg < 0] +# a1 = tmp1 +# a2 = tmp2 +# +# a1 = a1.reshape(-1,5) +# a2 = a2.reshape(-1,5) +# +# tmp1_pos = tmp1_pos.reshape(-1,5) +# tmp2_pos = tmp2_pos.reshape(-1,5) +# tmp1_neg = tmp1_neg.reshape(-1,5) +# tmp2_neg = tmp2_neg.reshape(-1,5) + + +print('a1:', a1) +print('a2:',a2 ) +print('a1.shape', a1.shape) + + + + + +energyVec = np.vectorize(energy) + +# Z = energyVec(np.array([a1,a2]),q1,q2,q12,q3,b1,b2) +Z = energyVec(a1,a2,q1,q2,q12,q3,b1,b2) + +Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) + + + + +print('Z:', Z) + +print('any', np.any(Z<0)) + +# + + +# negZ_a1 = a1[np.where(Z<0)] +# negZ_a2 = a2[np.where(Z<0)] +# negativeValues = Z[np.where(Z<0)] +# print('negativeValues:',negativeValues) +# +# print('negZ_a1',negZ_a1) +# print('negZ_a2',negZ_a2) +# +# +# negZ_a1 = negZ_a1.reshape(-1,5) +# negZ_a2 = negZ_a2.reshape(-1,5) +# negativeValues = negativeValues.reshape(-1,5) +# +# Z_pos = energyVec(tmp1_pos,tmp2_pos,q1,q2,q12,q3,b1,b2) +# Z_neg = energyVec(tmp1_neg,tmp2_neg,q1,q2,q12,q3,b1,b2) + + + + + +# print('Test energy:' , energy(np.array([1,1]),q1,q2,q12,q3,b1,b2)) + + + + +# print('Z_pos.shape', Z_pos.shape) + + + + + + + +## -- PLOT : +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + +label_size = 8 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +plt.style.use('seaborn') +# plt.style.use('seaborn-whitegrid') +# sns.set() +# plt.style.use('seaborn-whitegrid') + +label_size = 9 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +width = 6.28 *0.5 +# width = 6.28 *0.33 +# width = 6.28 +height = width #/ 1.618 + +# width = 452.9579/2 +# size= set_size(width, fraction=0.5) +# print('set_size(width, fraction=0.5)', set_size(width, fraction=1)) +# print('size[0]',size[0]) + +f_size = 10 +# fig= plt.figure() +fig, ax = plt.subplots() +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.5)) +# ax = plt.axes(projection ='3d', adjustable='box') +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) + +# ax = plt.axes((0.17,0.23 ,0.7,0.7)) +# ax = plt.axes((0.17,0.23 ,1.0,1.0)) +# ax=plt.axes() +# ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +ax.grid(True,which='major',axis='both',alpha=0.3) + +# Substract constant: +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c +# +# print('Value of c:', c) + + + +print('Z.min()', Z.min()) +print('Z.max()', Z.max()) +norm=mcolors.Normalize(Z.min(),Z.max()) +# facecolors=cm.brg(norm) + + + + +cmap=mpl.cm.RdBu_r +cmap=mpl.cm.viridis_r +# cmap=mpl.cm.bwr +cmap=mpl.cm.coolwarm +# cmap=mpl.cm.gnuplot +cmap=mpl.cm.magma_r +# cmap=mpl.cm.inferno_r +# cmap=mpl.cm.plasma +# cmap=mpl.cm.plasma_r +# cmap=mpl.cm.cividis_r +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","violet","red"]) +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","orange"]) + +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", [(0,"red"), (.1,"violet"), (.5, "blue"), (1.0, "green")]) +# make a colormap that has land and ocean clearly delineated and of the +# same length (256 + 256) +# +# colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256)) +# colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256)) +# all_colors = np.vstack((colors_undersea, colors_land)) +# # cmap = mcolors.LinearSegmentedColormap.from_list( +# # 'terrain_map', all_colors) + + +# cmap = px.colors.sequential.agsunset +# cmap = plotly.colors.PLOTLY_SCALES["Viridis"] + + + + +# cmap = cm.brg(Z) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=(Z.max()+Z.min())/2, vmax=Z.max()) +# divnorm=mcolors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=Z.max()) + +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0. ,vmax=10) +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0., vmax=Z.max()) + +# divnorm=mcolors.LogNorm(vmin=Z.min(), vmax=Z.max()) #Test LogNorm + +# cmap = cm.brg(divnorm(Z)) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap='coolwarm', alpha=0.6) +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap=cmap, alpha=0.6) + +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', +# cmap=cmap, alpha=0.6) + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.9) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', + # cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = mcolors.CenteredNorm(), +# cmap=cmap, alpha=0.6) + + + +# COLORBAR : +# cbar = plt.colorbar() +# cbar.ax.tick_params(labelsize=f_size) +# fig.colorbar(I) + + + +##----- ADD RECTANGLE TO COVER QUADRANT : +# epsilon = 0.4 +epsilon = 0.001 +# ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow + +fillcolor = 'royalblue' +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=1.0, color=fillcolor, zorder=4)#yellow + + +## FILL +ax.fill_between([x.min(), 0-epsilon], y.min(), 0-epsilon, alpha=.25, color=fillcolor, zorder=4)#yellow +ax.fill_between([0+epsilon, x.max()], 0+epsilon, y.max(), alpha=.25, color=fillcolor, zorder=4)#yellow + + +ax.text(1,1, r"$\mathcal{G}^+_{\mathbf{R}^2}$", color='royalblue', size=15) + +# ax.text(0.25,0.25, r"$\mathcal{S}$", color='darkorange', size=15) + +# PLOT 1-PARAMETER FAMILY + +print('abar:', abar) +print('abar[0,:]:', abar[0,:]) +print('abar[1,:]:', abar[1,:]) + +line = ax.plot(abar[:,0],abar[:,1], linewidth=2, color='darkorange', linestyle='-', zorder=4) + +# plt.arrow(x=1, y=0, dx=0.5, dy=0, ) +# ax.arrow(1, 0, 0.5, 0, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=5) +# plt.arrow(1, 0, 0.8, 0, shape='full', lw=0, length_includes_head=True, head_width=.15, zorder=5, color='purple') + + +## PLOT ARROW: +# plt.arrow(1, 0, 0.5, 0, shape='full', lw=0, length_includes_head=True, head_width=.20, zorder=5, color='darkorange') +# plt.arrow(0, 1.8, 0, -0.8, shape='full', lw=0, length_includes_head=True, head_width=.20, zorder=5, color='darkorange') + + +# plt.arrow(0, 1.8, 0, -0.8, lw=0, head_width=.12, zorder=5, color='darkorange') +# plt.arrow(0, 2, 0, -0.5, shape='full', lw=0, length_includes_head=True, head_width=.12, zorder=5, color='darkorange') +# add_arrow(line, color='darkorange') + + + + +# ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + + + +# ax.plot(theta_rho, energy_axial1, 'royalblue', zorder=3, label=r"axialMin1") +# ax.plot(theta_rho, energy_axial2, 'forestgreen', zorder=3, label=r"axialMin2") +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) + + +# print('test:',test) +# ax.scatter(test[0],test[1]) +# ax.arrow(test[0],test[1],abarperp[0],abarperp[1]) + +# lg = ax.legend(bbox_to_anchor=(0.0, 0.75), loc='upper left') + + + +### PLot x and y- Axes +ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=0.5) +ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5) + + + +ax.set_xlabel(r"$a_1$", fontsize=f_size ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=f_size ,labelpad=0) +# ax.set_ylabel(r"energy") +ax.tick_params(axis='both', which='major', labelsize=f_size) +ax.tick_params(axis='both', which='minor', labelsize=f_size) + + + +# ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax.set_yticklabels(labels) + +print('x.max()',x.max()) +print('y.max()',y.max()) +ax.set_xlim(x.min(),x.max()) +ax.set_xlim(y.min(),y.max()) + + + +# ax.legend(loc='upper right') + + + +fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.33)) +fig.savefig('Energy_ContourG+_Flat.pdf') + +plt.show() + + +# +# +# +# # Curve parametrised by \theta_rho = alpha in parameter space +# N=100; +# theta_rho = np.linspace(1, 3, num=N) +# print('theta_rho:', theta_rho) +# +# +# theta_values = [] +# +# +# for t in theta_rho: +# +# s = (1.0/10.0)*t+0.1 +# theta_values.append(s) +# +# +# +# +# +# theta_rho = np.array(theta_rho) +# theta_values = np.array(theta_values) +# +# betas_ = 2.0 +# + +# alphas, betas, thetas = np.meshgrid(theta_rho, betas_, theta_values, indexing='ij') +# +# +# harmonicMeanVec = np.vectorize(harmonicMean) +# arithmeticMeanVec = np.vectorize(arithmeticMean) +# prestrain_b1Vec = np.vectorize(prestrain_b1) +# prestrain_b2Vec = np.vectorize(prestrain_b2) +# +# GetMuGammaVec = np.vectorize(GetMuGamma) +# muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# +# q1_vec = harmonicMeanVec(mu1, betas, thetas) +# q2_vec = arithmeticMeanVec(mu1, betas, thetas) +# +# b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) + +# special case: q12 == 0!! .. braucht eigentlich nur b1 & b2 ... + +# print('type b1_values:', type(b1_values)) + + + +# print('size(q1)',q1.shape) +# +# +# energy_axial1 = [] +# energy_axial2 = [] +# +# # for b1 in b1_values: +# for i in range(len(theta_rho)): +# print('index i:', i) +# +# print('theta_rho[i]',theta_rho[i]) +# print('theta_values[i]',theta_values[i]) +# +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta_values[i]) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta_values[i]) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta_values[i],gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, theta_rho[i],theta_values[i] ) +# b2 = prestrain_b2(rho1,beta, theta_rho[i],theta_values[i] ) +# +# +# # q2_vec = arithmeticMean(mu1, betas, thetas) +# # +# # b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# # b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) +# print('q1[i]',q1) +# print('q2[i]',q2) +# print('q3[i]',q3) +# print('b1[i]',b1) +# print('b2[i]',b2) +# # print('q1[i]',q1[0][i]) +# # print('q2[i]',q2[i]) +# # print('b1[i]',b1[i]) +# # print('b2[i]',b2[i]) +# #compute axial energy #1 ... +# +# a_axial1 = np.array([b1,0]) +# a_axial2 = np.array([0,b2]) +# b = np.array([b1,b2]) +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a_axial1) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial1',a_axial1) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial1.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial1.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_1 = tmp - tmp2 +# print('energy_1',energy_1) +# +# +# energy_axial1.append(energy_1) +# +# +# tmp = H.dot(a_axial2) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial2',a_axial2) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial2.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial2.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_2 = tmp - tmp2 +# print('energy_2',energy_2) +# +# +# energy_axial2.append(energy_2) +# +# +# +# +# +# print('theta_values', theta_values) +# +# +# + + +# +# +# +# +# kappas = [] +# alphas = [] +# # G.append(float(s[0])) +# +# +# +# +# for t in T : +# +# abar_current = sstar*abar+t*abarperp; +# # print('abar_current', abar_current) +# abar_current[abar_current < 1e-10] = 0 +# # print('abar_current', abar_current) +# +# # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] +# +# e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] +# kappa = abar_current[0]+abar_current[1] +# alpha = math.atan2(e[1], e[0]) +# +# print('angle current:', alpha) +# +# kappas.append(kappa) +# alphas.append(alpha) +# +# +# +# alphas = np.array(alphas) +# kappas = np.array(kappas) +# +# +# print('kappas:',kappas) +# print('alphas:',alphas) +# print('min alpha:', min(alphas)) +# print('min kappa:', min(kappas)) +# +# mpl.rcParams['text.usetex'] = True +# mpl.rcParams["font.family"] = "serif" +# mpl.rcParams["font.size"] = "9" +# width = 6.28 *0.5 +# height = width / 1.618 +# fig = plt.figure() +# # ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# # ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# # ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# # ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) +# +# +# +# +# ax.plot(alphas, kappas, 'royalblue', zorder=3, ) +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) diff --git a/src/1-ParameterFamily_G+_Flat_v2.py b/src/1-ParameterFamily_G+_Flat_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..3f9775cef627b1d22527a364ae288d1445446f71 --- /dev/null +++ b/src/1-ParameterFamily_G+_Flat_v2.py @@ -0,0 +1,1121 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +import seaborn as sns +import matplotlib.colors as mcolors + +from chart_studio import plotly +import plotly.graph_objs as go +import plotly.express as px +import plotly.colors +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def show(fig): + import io + import plotly.io as pio + from PIL import Image + buf = io.BytesIO() + pio.write_image(fig, buf) + img = Image.open(buf) + img.show() + + + + +def add_arrow(line, position=None, direction='right', size=15, color=None): + """ + add an arrow to a line. + + line: Line2D object + position: x-position of the arrow. If None, mean of xdata is taken + direction: 'left' or 'right' + size: size of the arrow in fontsize points + color: if None, line color is taken. + """ + if color is None: + color = line.get_color() + + xdata = line.get_xdata() + ydata = line.get_ydata() + + if position is None: + position = xdata.mean() + # find closest index + start_ind = np.argmin(np.absolute(xdata - position)) + if direction == 'right': + end_ind = start_ind + 1 + else: + end_ind = start_ind - 1 + + line.axes.annotate('', + xytext=(xdata[start_ind], ydata[start_ind]), + xy=(xdata[end_ind], ydata[end_ind]), + arrowprops=dict(arrowstyle="->", color=color), + size=size + ) + + +# set the colormap and centre the colorbar +class MidpointNormalize(mcolors.Normalize): + """ + Normalise the colorbar so that diverging bars work there way either side from a prescribed midpoint value) + + e.g. im=ax1.imshow(array, norm=MidpointNormalize(midpoint=0.,vmin=-100, vmax=100)) + """ + def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): + self.midpoint = midpoint + mcolors.Normalize.__init__(self, vmin, vmax, clip) + + def __call__(self, value, clip=None): + # I'm ignoring masked values and all kinds of edge cases to make a + # simple example... + x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] + return np.ma.masked_array(np.interp(value, x, y), np.isnan(value)) + + + +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + + +def format_func(value, tick_number): + # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == -1: + # return r"$-\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + ##find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == -1: + return r"$-\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N == -2: + return r"$-\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +def energy(a1,a2,q1,q2,q12,q3,b1,b2): + + + a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + tmp = H.dot(a) + + # print('H',H) + # print('A',A) + # print('b',b) + # print('a',a) + # print('tmp',tmp) + + tmp = (1/2)*a.dot(tmp) + # print('tmp',tmp) + + tmp2 = A.dot(b) + # print('tmp2',tmp2) + tmp2 = 2*a.dot(tmp2) + + # print('tmp2',tmp2) + energy = tmp - tmp2 + # print('energy',energy) + + + # energy_axial1.append(energy_1) + + return energy + + + +# def energy(a1,a2,q1,q2,q12,q3,b1,b2): +# +# +# b = np.array([b1,b2]) +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a',a) +# print('tmp',tmp) +# +# tmp = (1/2)*a.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a.dot(tmp2) +# +# print('tmp2',tmp2) +# energy = tmp - tmp2 +# print('energy',energy) +# +# +# # energy_axial1.append(energy_1) +# +# return energy +# + + + + + +################################################################################################################ +################################################################################################################ +################################################################################################################ + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') + +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# +# print('abar:',abar) +# +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# +# +# # print('abar:',np.shape(abar)) +# # print('np.transpose(abar):',np.shape(np.transpose(abar))) +# sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# # sstar = (1/(q1+q2))*abar.dot(tmp) +# print('sstar', sstar) +# abarperp= np.array([abar[1],-abar[0]]) +# print('abarperp:',abarperp) + + +# -------------------------- Input Parameters -------------------- + +mu1 = 1.0 +rho1 = 1.0 +alpha = 5.0 +theta = 1.0/2 +# theta= 0.1 +beta = 5.0 + + + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = -0.75 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +#Figure3: +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/8 +# # theta= 0.1 +# beta = 2.0 + + +# alpha= -5 + + +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +gamma = '0' +# gamma = 'infinity' + + +lambda1 = 0.0 + + +print('---- Input parameters: -----') +print('mu1: ', mu1) +print('rho1: ', rho1) +# print('alpha: ', alpha) +print('beta: ', beta) +# print('theta: ', theta) +print('gamma:', gamma) + +print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- +print('----------------------------') + +# ---------------------------------------------------------------- + + + + + + +q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +q12 = 0.0 +q3 = GetMuGamma(beta, theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +b1 = prestrain_b1(rho1,beta, alpha, theta ) +b2 = prestrain_b2(rho1,beta, alpha, theta ) + + +## ---- 1-ParameterFamilyCase: +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# print('abar:',abar) +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# b1=b[0] +# b2=b[1] +## --------------- + + + + + +######################################## + +# 1-ParameterFamilyCase: + +q1=1; +q2=2; +q12=1/2; +q3=((4*q1*q2)**0.5-q12)/2; +# H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + +H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +abar = np.array([q12+2*q3, 2*q2]) +abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + +print('abar:',abar) + +b = np.linalg.lstsq(A, abar)[0] +print('b',b) + +b1=b[0] +b2=b[1] + + +##---------------------- +print('q1 = ', q1) +print('q2 = ', q2) +print('q3 = ', q3) +print('q12 = ', q12) +print('b1 = ', b1) +print('b2 = ', b2) +##-------------- + + +# print('abar:',np.shape(abar)) +# print('np.transpose(abar):',np.shape(np.transpose(abar))) +sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# sstar = (1/(q1+q2))*abar.dot(tmp) +print('sstar', sstar) +abarperp= np.array([abar[1],-abar[0]]) +print('abarperp:',abarperp) + +print('sstar*abar:', sstar*abar) +# print('np.dot(sstar*abar):', np.dot(sstar*abar)) +print('----------------------------') + + +N=1000; +N=10; +scale_domain = 5 +translate_startpoint = -1.8 +T_line = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) +line_values = [] +for t in T_line : + print('sstar*abar+t*abarperp', sstar*abar+t*abarperp) + line_values.append(sstar*abar+t*abarperp) + + + + +T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) + +# T = np.linspace(-2,2, num=N) +# print('T:', T) + +print('T.min():', T.min()) +print('T.max():', T.max()) + +kappas = [] +alphas = [] +# G.append(float(s[0])) + +G_container = [] +abar_container = [] + +test = sstar*abar + + +abar_tmp = abar + +for t in T : + abar_current = sstar*abar+t*abarperp; + abar_current[abar_current < 1e-10] = 0 # Projection onto x-y-axis!! + print('abar_current', abar_current) + G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] + G_container.append(G) + abar_container.append(abar_current) + e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] + kappa = abar_current[0]+abar_current[1] + alpha = math.atan2(e[1], e[0]) + # print('angle current:', alpha) + kappas.append(kappa) + alphas.append(alpha) + + +alphas = np.array(alphas) +kappas = np.array(kappas) + +# print('G_container', G_container) +G = np.array(G_container) +abar = np.array(abar_container) + +print('G', G) +print('abar', abar) +print('abar.shape',abar.shape) + + + + + + + + + + +###################################### + + + +num_Points = 400 +num_Points = 200 +# num_Points = 20 + + +# Creating dataset +x = np.linspace(-5,5,num_Points) +y = np.linspace(-5,5,num_Points) + +x = np.linspace(-20,20,num_Points) +y = np.linspace(-20,20,num_Points) + + +x = np.linspace(-2,2,num_Points) +y = np.linspace(-2,2,num_Points) + +# x = np.linspace(-10,10,num_Points) +# y = np.linspace(-10,10,num_Points) + +# x = np.linspace(-60,60,num_Points) +# y = np.linspace(-60,60,num_Points) +# +# +# x = np.linspace(-40,40,num_Points) +# y = np.linspace(-40,40,num_Points) + + +a1, a2 = np.meshgrid(x,y) + +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) + +ContourRange=20 + +x_in = np.linspace(-ContourRange,ContourRange,num_Points) +y_in = np.linspace(-ContourRange,ContourRange,num_Points) +a1_in, a2_in = np.meshgrid(x_in,y_in) + +print('a1:', a1) +print('a2:',a2 ) + +print('a1.shape', a1.shape) + +#-- FILTER OUT VALUES for G+ : + +# tmp1 = a1[np.where(a1*a2 >= 0)] +# tmp2 = a2[np.where(a1*a2 >= 0)] +# +# np.take(a, np.where(a>100)[0], axis=0) +# tmp1 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = a2[np.where(a1*a2 >= 0)] + +tmp1 = a1[a1*a2 >= 0] +tmp2 = a2[a1*a2 >= 0] +tmp1 = tmp1.reshape(-1,5) +tmp2 = tmp2.reshape(-1,5) + + +# tmp1_pos = a1[np.where(a1*a2 >= 0) ] +# tmp2_pos = a2[np.where(a1*a2 >= 0) ] +# tmp1_pos = tmp1_pos[np.where(tmp1_pos >= 0)] +# tmp2_pos = tmp2_pos[np.where(tmp2_pos >= 0)] +# +# tmp1_neg = a1[a1*a2 >= 0 ] +# tmp2_neg = a2[a1*a2 >= 0 ] +# tmp1_neg = tmp1_neg[tmp1_neg < 0] +# tmp2_neg = tmp2_neg[tmp2_neg < 0] +# a1 = tmp1 +# a2 = tmp2 +# +# a1 = a1.reshape(-1,5) +# a2 = a2.reshape(-1,5) +# +# tmp1_pos = tmp1_pos.reshape(-1,5) +# tmp2_pos = tmp2_pos.reshape(-1,5) +# tmp1_neg = tmp1_neg.reshape(-1,5) +# tmp2_neg = tmp2_neg.reshape(-1,5) + + +print('a1:', a1) +print('a2:',a2 ) +print('a1.shape', a1.shape) + + + + + +energyVec = np.vectorize(energy) + +# Z = energyVec(np.array([a1,a2]),q1,q2,q12,q3,b1,b2) +Z = energyVec(a1,a2,q1,q2,q12,q3,b1,b2) + +Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) + + + + +print('Z:', Z) + +print('any', np.any(Z<0)) + +# + + +# negZ_a1 = a1[np.where(Z<0)] +# negZ_a2 = a2[np.where(Z<0)] +# negativeValues = Z[np.where(Z<0)] +# print('negativeValues:',negativeValues) +# +# print('negZ_a1',negZ_a1) +# print('negZ_a2',negZ_a2) +# +# +# negZ_a1 = negZ_a1.reshape(-1,5) +# negZ_a2 = negZ_a2.reshape(-1,5) +# negativeValues = negativeValues.reshape(-1,5) +# +# Z_pos = energyVec(tmp1_pos,tmp2_pos,q1,q2,q12,q3,b1,b2) +# Z_neg = energyVec(tmp1_neg,tmp2_neg,q1,q2,q12,q3,b1,b2) + + + + + +# print('Test energy:' , energy(np.array([1,1]),q1,q2,q12,q3,b1,b2)) + + + + +# print('Z_pos.shape', Z_pos.shape) + + + + + + + +## -- PLOT : +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + +label_size = 8 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +plt.style.use('seaborn') +# plt.style.use('seaborn-whitegrid') +# sns.set() +# plt.style.use('seaborn-whitegrid') + +label_size = 9 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +width = 6.28 *0.5 +# width = 6.28 *0.33 +# width = 6.28 +height = width #/ 1.618 + +# width = 452.9579/2 +# size= set_size(width, fraction=0.5) +# print('set_size(width, fraction=0.5)', set_size(width, fraction=1)) +# print('size[0]',size[0]) + +f_size = 10 +# fig= plt.figure() +fig, ax = plt.subplots() +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.5)) +# ax = plt.axes(projection ='3d', adjustable='box') +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) + +# ax = plt.axes((0.17,0.23 ,0.7,0.7)) +# ax = plt.axes((0.17,0.23 ,1.0,1.0)) +# ax=plt.axes() +# ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +ax.grid(True,which='major',axis='both',alpha=0.3) + +# Substract constant: +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c +# +# print('Value of c:', c) + + + +print('Z.min()', Z.min()) +print('Z.max()', Z.max()) +norm=mcolors.Normalize(Z.min(),Z.max()) +# facecolors=cm.brg(norm) + + + + +cmap=mpl.cm.RdBu_r +cmap=mpl.cm.viridis_r +# cmap=mpl.cm.bwr +cmap=mpl.cm.coolwarm +# cmap=mpl.cm.gnuplot +cmap=mpl.cm.magma_r +# cmap=mpl.cm.inferno_r +# cmap=mpl.cm.plasma +# cmap=mpl.cm.plasma_r +# cmap=mpl.cm.cividis_r +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","violet","red"]) +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","orange"]) + +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", [(0,"red"), (.1,"violet"), (.5, "blue"), (1.0, "green")]) +# make a colormap that has land and ocean clearly delineated and of the +# same length (256 + 256) +# +# colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256)) +# colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256)) +# all_colors = np.vstack((colors_undersea, colors_land)) +# # cmap = mcolors.LinearSegmentedColormap.from_list( +# # 'terrain_map', all_colors) + + +# cmap = px.colors.sequential.agsunset +# cmap = plotly.colors.PLOTLY_SCALES["Viridis"] + + + + +# cmap = cm.brg(Z) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=(Z.max()+Z.min())/2, vmax=Z.max()) +# divnorm=mcolors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=Z.max()) + +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0. ,vmax=10) +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0., vmax=Z.max()) + +# divnorm=mcolors.LogNorm(vmin=Z.min(), vmax=Z.max()) #Test LogNorm + +# cmap = cm.brg(divnorm(Z)) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap='coolwarm', alpha=0.6) +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap=cmap, alpha=0.6) + +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', +# cmap=cmap, alpha=0.6) + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.9) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', + # cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = mcolors.CenteredNorm(), +# cmap=cmap, alpha=0.6) + + + +# COLORBAR : +# cbar = plt.colorbar() +# cbar.ax.tick_params(labelsize=f_size) +# fig.colorbar(I) + + + +##----- ADD RECTANGLE TO COVER QUADRANT : +# epsilon = 0.4 +epsilon = 0.001 +# ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow + +fillcolor = 'royalblue' +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=1.0, color=fillcolor, zorder=4)#yellow + + +## FILL +ax.fill_between([x.min(), 0-epsilon], y.min(), 0-epsilon, alpha=.25, color=fillcolor, zorder=4)#yellow +ax.fill_between([0+epsilon, x.max()], 0+epsilon, y.max(), alpha=.25, color=fillcolor, zorder=4)#yellow + + +ax.text(1,1, r"$\mathcal{G}^+_{\mathbf{R}^2}$", color='royalblue', size=15) + +# ax.text(0.25,0.25, r"$\mathcal{S}$", color='darkorange', size=15) + +# PLOT 1-PARAMETER FAMILY + +print('abar:', abar) +print('abar[0,:]:', abar[0,:]) +print('abar[1,:]:', abar[1,:]) + +line = ax.plot(abar[:,0],abar[:,1], linewidth=1.5, color='darkorange', linestyle='-', zorder=4) + +# plt.arrow(x=1, y=0, dx=0.5, dy=0, ) +# ax.arrow(1, 0, 0.5, 0, head_width=0.05, head_length=0.1, fc='k', ec='k', zorder=5) +# plt.arrow(1, 0, 0.8, 0, shape='full', lw=0, length_includes_head=True, head_width=.15, zorder=5, color='purple') + + +## PLOT ARROW: +# plt.arrow(1, 0, 0.5, 0, shape='full', lw=0, length_includes_head=True, head_width=.20, zorder=5, color='darkorange') +# plt.arrow(0, 1.8, 0, -0.8, shape='full', lw=0, length_includes_head=True, head_width=.20, zorder=5, color='darkorange') + + +# plt.arrow(0, 1.8, 0, -0.8, lw=0, head_width=.12, zorder=5, color='darkorange') +# plt.arrow(0, 2, 0, -0.5, shape='full', lw=0, length_includes_head=True, head_width=.12, zorder=5, color='darkorange') +# add_arrow(line, color='darkorange') + + + + +# ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + + + +# ax.plot(theta_rho, energy_axial1, 'royalblue', zorder=3, label=r"axialMin1") +# ax.plot(theta_rho, energy_axial2, 'forestgreen', zorder=3, label=r"axialMin2") +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) + + +# print('test:',test) +# ax.scatter(test[0],test[1]) +# ax.arrow(test[0],test[1],abarperp[0],abarperp[1]) +line_values= np.array(line_values) + +ax.plot(line_values[:,0],line_values[:,1],'k--', linewidth=1,color='orange',alpha=0.5) + +# lg = ax.legend(bbox_to_anchor=(0.0, 0.75), loc='upper left') + + + +### PLot x and y- Axes +ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=0.5) +ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5) + + + +ax.set_xlabel(r"$a_1$", fontsize=f_size ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=f_size ,labelpad=0) +# ax.set_ylabel(r"energy") +ax.tick_params(axis='both', which='major', labelsize=f_size) +ax.tick_params(axis='both', which='minor', labelsize=f_size) + + + +# ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax.set_yticklabels(labels) + +print('x.max()',x.max()) +print('y.max()',y.max()) +ax.set_xlim(x.min(),x.max()) +ax.set_xlim(y.min(),y.max()) + + + +# ax.legend(loc='upper right') + + + +fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.33)) +fig.savefig('Energy_ContourG+_Flat.pdf') + +plt.show() + + +# +# +# +# # Curve parametrised by \theta_rho = alpha in parameter space +# N=100; +# theta_rho = np.linspace(1, 3, num=N) +# print('theta_rho:', theta_rho) +# +# +# theta_values = [] +# +# +# for t in theta_rho: +# +# s = (1.0/10.0)*t+0.1 +# theta_values.append(s) +# +# +# +# +# +# theta_rho = np.array(theta_rho) +# theta_values = np.array(theta_values) +# +# betas_ = 2.0 +# + +# alphas, betas, thetas = np.meshgrid(theta_rho, betas_, theta_values, indexing='ij') +# +# +# harmonicMeanVec = np.vectorize(harmonicMean) +# arithmeticMeanVec = np.vectorize(arithmeticMean) +# prestrain_b1Vec = np.vectorize(prestrain_b1) +# prestrain_b2Vec = np.vectorize(prestrain_b2) +# +# GetMuGammaVec = np.vectorize(GetMuGamma) +# muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# +# q1_vec = harmonicMeanVec(mu1, betas, thetas) +# q2_vec = arithmeticMeanVec(mu1, betas, thetas) +# +# b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) + +# special case: q12 == 0!! .. braucht eigentlich nur b1 & b2 ... + +# print('type b1_values:', type(b1_values)) + + + +# print('size(q1)',q1.shape) +# +# +# energy_axial1 = [] +# energy_axial2 = [] +# +# # for b1 in b1_values: +# for i in range(len(theta_rho)): +# print('index i:', i) +# +# print('theta_rho[i]',theta_rho[i]) +# print('theta_values[i]',theta_values[i]) +# +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta_values[i]) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta_values[i]) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta_values[i],gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, theta_rho[i],theta_values[i] ) +# b2 = prestrain_b2(rho1,beta, theta_rho[i],theta_values[i] ) +# +# +# # q2_vec = arithmeticMean(mu1, betas, thetas) +# # +# # b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# # b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) +# print('q1[i]',q1) +# print('q2[i]',q2) +# print('q3[i]',q3) +# print('b1[i]',b1) +# print('b2[i]',b2) +# # print('q1[i]',q1[0][i]) +# # print('q2[i]',q2[i]) +# # print('b1[i]',b1[i]) +# # print('b2[i]',b2[i]) +# #compute axial energy #1 ... +# +# a_axial1 = np.array([b1,0]) +# a_axial2 = np.array([0,b2]) +# b = np.array([b1,b2]) +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a_axial1) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial1',a_axial1) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial1.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial1.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_1 = tmp - tmp2 +# print('energy_1',energy_1) +# +# +# energy_axial1.append(energy_1) +# +# +# tmp = H.dot(a_axial2) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial2',a_axial2) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial2.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial2.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_2 = tmp - tmp2 +# print('energy_2',energy_2) +# +# +# energy_axial2.append(energy_2) +# +# +# +# +# +# print('theta_values', theta_values) +# +# +# + + +# +# +# +# +# kappas = [] +# alphas = [] +# # G.append(float(s[0])) +# +# +# +# +# for t in T : +# +# abar_current = sstar*abar+t*abarperp; +# # print('abar_current', abar_current) +# abar_current[abar_current < 1e-10] = 0 +# # print('abar_current', abar_current) +# +# # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] +# +# e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] +# kappa = abar_current[0]+abar_current[1] +# alpha = math.atan2(e[1], e[0]) +# +# print('angle current:', alpha) +# +# kappas.append(kappa) +# alphas.append(alpha) +# +# +# +# alphas = np.array(alphas) +# kappas = np.array(kappas) +# +# +# print('kappas:',kappas) +# print('alphas:',alphas) +# print('min alpha:', min(alphas)) +# print('min kappa:', min(kappas)) +# +# mpl.rcParams['text.usetex'] = True +# mpl.rcParams["font.family"] = "serif" +# mpl.rcParams["font.size"] = "9" +# width = 6.28 *0.5 +# height = width / 1.618 +# fig = plt.figure() +# # ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# # ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# # ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# # ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) +# +# +# +# +# ax.plot(alphas, kappas, 'royalblue', zorder=3, ) +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) diff --git a/src/1-ParameterFamily_G+_v3.py b/src/1-ParameterFamily_G+_v3.py index beaa0763212583e92aae9071b92fd1d39aa2804d..ee1240696d58bf30c52eab92faeaf006f1ed0155 100644 --- a/src/1-ParameterFamily_G+_v3.py +++ b/src/1-ParameterFamily_G+_v3.py @@ -407,9 +407,12 @@ print('----------------------------') # ---------------------------------------------------------------- N=1000; +# scale_domain = 5 +# translate_startpoint = -5 + scale_domain = 5 +translate_startpoint = -1.8 -translate_startpoint = -5 # T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) T = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) @@ -697,8 +700,9 @@ mpl.rcParams['xtick.labelsize'] = label_size mpl.rcParams['ytick.labelsize'] = label_size width = 6.28 *0.5 -width = 6.28 +# width = 6.28 height = width / 1.618 +height = width fig = plt.figure() ax = plt.axes(projection ='3d', adjustable='box') @@ -872,6 +876,10 @@ cmap = mpl.colors.ListedColormap(["royalblue"], name='from_list', N=None) + +print('abar', abar) +print('abar.shape',abar.shape) + line = ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=2, color='coral', zorder=1) # CS = ax.contour(X_1,Y_1,Z1, colors='k', levels=18, linewidths=(0.5,)) @@ -882,7 +890,8 @@ end = np.array([abar[0,500],abar[1,500],Z_bar[500]]) -idx = np.where(np.round(Z_bar,3) == np.round( 0.03581463,3) ) +# idx = np.where(np.round(Z_bar,3) == np.round( 0.03581463,3) ) +idx = np.where(np.round(Z_bar,3) == np.round( 0.02823972,3) ) print('idx[0][0]', idx[0][0]) # abar_1 = abar[0,0:idx[0][0]] @@ -1034,8 +1043,11 @@ print('dir:', dir) arrow_prop_dict = dict(mutation_scale=20, arrowstyle='-|>', color='k', shrinkA=0, shrinkB=0) # style = ArrowStyle('Fancy', head_length=1, head_width=1.5, tail_width=0.5) -a = Arrow3D([start[0], end[0]], [start[1], end[1]], [start[2], end[2]], mutation_scale=15, arrowstyle='-|>', color='darkorange') -ax.add_artist(a) + + +# ADD ARROW: +# a = Arrow3D([start[0], end[0]], [start[1], end[1]], [start[2], end[2]], mutation_scale=15, arrowstyle='-|>', color='darkorange') +# ax.add_artist(a) ## ADD Annotation ax.text(0, 0, 1.5, r"$\mathcal G^+$", color='royalblue', size=12) diff --git a/src/1-ParameterFamily_G+_v4.py b/src/1-ParameterFamily_G+_v4.py new file mode 100644 index 0000000000000000000000000000000000000000..4b8cdd19568ed7bd2afa2dada8bbf6ce9f0fe3a9 --- /dev/null +++ b/src/1-ParameterFamily_G+_v4.py @@ -0,0 +1,1141 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +import seaborn as sns +import matplotlib.colors as mcolors + + +from mpl_toolkits.mplot3d.proj3d import proj_transform +from mpl_toolkits.mplot3d import proj3d +# from mpl_toolkits.mplot3d.axes3d import Axes3D +from matplotlib.text import Annotation +from matplotlib.patches import FancyArrowPatch + + +import mayavi.mlab as mlab +from mayavi.api import OffScreenEngine +mlab.options.offscreen = True + +from chart_studio import plotly +import plotly.graph_objs as go +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + +# set the colormap and centre the colorbar +class MidpointNormalize(mcolors.Normalize): + """ + Normalise the colorbar so that diverging bars work there way either side from a prescribed midpoint value) + + e.g. im=ax1.imshow(array, norm=MidpointNormalize(midpoint=0.,vmin=-100, vmax=100)) + """ + def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): + self.midpoint = midpoint + mcolors.Normalize.__init__(self, vmin, vmax, clip) + + def __call__(self, value, clip=None): + # I'm ignoring masked values and all kinds of edge cases to make a + # simple example... + x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] + return np.ma.masked_array(np.interp(value, x, y), np.isnan(value)) + + + +def format_func(value, tick_number): + # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == -1: + # return r"$-\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + ##find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == -1: + return r"$-\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N == -2: + return r"$-\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +def energy(a1,a2,q1,q2,q12,q3,b1,b2): + + + a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + tmp = H.dot(a) + + # print('H',H) + # print('A',A) + # print('b',b) + # print('a',a) + # print('tmp',tmp) + + tmp = (1/2)*a.dot(tmp) + # print('tmp',tmp) + + tmp2 = A.dot(b) + # print('tmp2',tmp2) + tmp2 = 2*a.dot(tmp2) + + # print('tmp2',tmp2) + energy = tmp - tmp2 + # print('energy',energy) + + + # energy_axial1.append(energy_1) + + return energy + + + +def evaluate(x,y): + + # (abar[0,:]*abar[1,:])**0.5 + + return np.sqrt(x*y) + + +# def energy(a1,a2,q1,q2,q12,q3,b1,b2): +# +# +# b = np.array([b1,b2]) +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a',a) +# print('tmp',tmp) +# +# tmp = (1/2)*a.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a.dot(tmp2) +# +# print('tmp2',tmp2) +# energy = tmp - tmp2 +# print('energy',energy) +# +# +# # energy_axial1.append(energy_1) +# +# return energy +# + +def add_arrow(line, position=None, direction='right', size=15, color=None): + """ + add an arrow to a line. + + line: Line2D object + position: x-position of the arrow. If None, mean of xdata is taken + direction: 'left' or 'right' + size: size of the arrow in fontsize points + color: if None, line color is taken. + """ + if color is None: + color = line.get_color() + + xdata = line.get_xdata() + ydata = line.get_ydata() + + if position is None: + position = xdata.mean() + # find closest index + start_ind = np.argmin(np.absolute(xdata - position)) + if direction == 'right': + end_ind = start_ind + 1 + else: + end_ind = start_ind - 1 + + line.axes.annotate('', + xytext=(xdata[start_ind], ydata[start_ind]), + xy=(xdata[end_ind], ydata[end_ind]), + arrowprops=dict(arrowstyle="->", color=color), + size=size + ) + + + +class Annotation3D(Annotation): + def __init__(self, text, xyz, *args, **kwargs): + super().__init__(text, xy=(0, 0), *args, **kwargs) + self._xyz = xyz + + def draw(self, renderer): + x2, y2, z2 = proj_transform(*self._xyz, self.axes.M) + self.xy = (x2, y2) + super().draw(renderer) + +def _annotate3D(ax, text, xyz, *args, **kwargs): + '''Add anotation `text` to an `Axes3d` instance.''' + + annotation = Annotation3D(text, xyz, *args, **kwargs) + ax.add_artist(annotation) + +setattr(Axes3D, 'annotate3D', _annotate3D) + + + +class Arrow3D(FancyArrowPatch): + def __init__(self, xs, ys, zs, *args, **kwargs): + FancyArrowPatch.__init__(self, (0,0), (0,0), *args, **kwargs) + self._verts3d = xs, ys, zs + + def draw(self, renderer): + xs3d, ys3d, zs3d = self._verts3d + xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M) + self.set_positions((xs[0],ys[0]),(xs[1],ys[1])) + FancyArrowPatch.draw(self, renderer) + + +def _arrow3D(ax, x, y, z, dx, dy, dz, *args, **kwargs): + '''Add an 3d arrow to an `Axes3D` instance.''' + + arrow = Arrow3D(x, y, z, dx, dy, dz, *args, **kwargs) + ax.add_artist(arrow) + +setattr(Axes3D, 'arrow3D', _arrow3D) + +################################################################################################################ +################################################################################################################ +################################################################################################################ + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') + +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# +# print('abar:',abar) +# +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# +# +# # print('abar:',np.shape(abar)) +# # print('np.transpose(abar):',np.shape(np.transpose(abar))) +# sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# # sstar = (1/(q1+q2))*abar.dot(tmp) +# print('sstar', sstar) +# abarperp= np.array([abar[1],-abar[0]]) +# print('abarperp:',abarperp) + + +# -------------------------- Input Parameters -------------------- + +mu1 = 1.0 +rho1 = 1.0 +alpha = 5.0 +theta = 1.0/2 +# theta= 0.1 +beta = 5.0 + + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +#Figure3: +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/8 +# # theta= 0.1 +# beta = 2.0 + + +# alpha= -5 + + +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +gamma = '0' +gamma = 'infinity' + + +lambda1 = 0.0 + + +print('---- Input parameters: -----') +print('mu1: ', mu1) +print('rho1: ', rho1) +# print('alpha: ', alpha) +print('beta: ', beta) +# print('theta: ', theta) +print('gamma:', gamma) + +print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- +print('----------------------------') + +# ---------------------------------------------------------------- + + + + + + +q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +q12 = 0.0 +q3 = GetMuGamma(beta, theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +b1 = prestrain_b1(rho1,beta, alpha, theta ) +b2 = prestrain_b2(rho1,beta, alpha, theta ) + + +# 1-ParameterFamilyCase: + +q1=1; +q2=2; +q12=1/2; +q3=((4*q1*q2)**0.5-q12)/2; +# H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + +H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +abar = np.array([q12+2*q3, 2*q2]) +abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + +print('abar:',abar) + +b = np.linalg.lstsq(A, abar)[0] +print('b',b) + +b1=b[0] +b2=b[1] + + +# print('abar:',np.shape(abar)) +# print('np.transpose(abar):',np.shape(np.transpose(abar))) +sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# sstar = (1/(q1+q2))*abar.dot(tmp) +print('sstar', sstar) +abarperp= np.array([abar[1],-abar[0]]) +print('abarperp:',abarperp) + +print('----------------------------') + +# ---------------------------------------------------------------- + +N=1000; +# scale_domain = 5 +# translate_startpoint = -5 + +# scale_domain = 5 +# translate_startpoint = -1.8 + + +scale_domain = 5 +translate_startpoint = -1.8 +T_line = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) +line_values = [] +for t in T_line : + print('sstar*abar+t*abarperp', sstar*abar+t*abarperp) + line_values.append(sstar*abar+t*abarperp) + + + + +T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) +# T = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) +# T = np.linspace(-2,2, num=N) +# print('T:', T) + +print('T.min():', T.min()) +print('T.max():', T.max()) + +kappas = [] +alphas = [] +# G.append(float(s[0])) + +G_container = [] +abar_container = [] + + +abar_tmp = abar + +for t in T : + abar_current = sstar*abar+t*abarperp; + # print('abar_current', abar_current) + abar_current[abar_current < 1e-10] = 0 + # print('abar_current', abar_current) + # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] + # print('type of G', type(G)) + # print('G', G) + G_container.append(G) + abar_container.append(abar_current) + e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] + kappa = abar_current[0]+abar_current[1] + alpha = math.atan2(e[1], e[0]) + # print('angle current:', alpha) + kappas.append(kappa) + alphas.append(alpha) + + +alphas = np.array(alphas) +kappas = np.array(kappas) + +# print('G_container', G_container) +G = np.array(G_container) +abar = np.array(abar_container) + +print('G', G) +print('abar', abar) +print('abar.shape',abar.shape) + + + + + +print('q1 = ', q1) +print('q2 = ', q2) +print('q3 = ', q3) +print('q12 = ', q12) +print('b1 = ', b1) +print('b2 = ', b2) + +num_Points = 20 +num_Points = 50 +num_Points = 200 + +# Creating dataset +x = np.linspace(-5,5,num_Points) +y = np.linspace(-5,5,num_Points) + +x = np.linspace(-20,20,num_Points) +y = np.linspace(-20,20,num_Points) + +# x = np.linspace(-10,10,num_Points) +# y = np.linspace(-10,10,num_Points) + +# x = np.linspace(-60,60,num_Points) +# y = np.linspace(-60,60,num_Points) +# +# +# x = np.linspace(-40,40,num_Points) +# y = np.linspace(-40,40,num_Points) + + +range = 2 + +x_1 = np.linspace(0,range,num_Points) +y_1 = np.linspace(0,range,num_Points) +x_2 = np.linspace(-range,0,num_Points) +y_2 = np.linspace(-range,0,num_Points) + + +X_1,Y_1 = np.meshgrid(x_1,y_1) +X_2,Y_2 = np.meshgrid(x_2,y_2) + + +a1, a2 = np.meshgrid(x,y) + +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) + +ContourRange=20 + +x_in = np.linspace(-ContourRange,ContourRange,num_Points) +y_in = np.linspace(-ContourRange,ContourRange,num_Points) +a1_in, a2_in = np.meshgrid(x_in,y_in) + +# print('a1:', a1) +# print('a2:',a2 ) +# +# print('a1.shape', a1.shape) + +#-- FILTER OUT VALUES for G+ : + +tmp1 = a1[np.where(a1*a2 >= 0)] +tmp2 = a2[np.where(a1*a2 >= 0)] + +# tmp1 = a1[a1*a2 >= 0] +# tmp2 = a2[a1*a2 >= 0] + +# tmp1 = a1[np.where(a1>=0 and a2 >= 0)] +# tmp2 = a2[np.where(a1>=0 and a2 >= 0)] + + +# tmp1 = tmp1[np.where(a1 >= 0)] +# tmp2 = tmp2[np.where(a1 >= 0)] + +# tmp1_pos = a1[np.where(a1*a2 >= 0)] +# tmp2_neg = a2[np.where(a1*a2 >= 0)] + + + +print('tmp1.shape',tmp1.shape) +print('tmp1.shape[0]',tmp1.shape[0]) +print('tmp2.shape',tmp2.shape) +print('tmp2.shape[0]',tmp2.shape[0]) + + + +tmp1 = tmp1.reshape(-1,int(tmp1.shape[0]/2)) +tmp2 = tmp2.reshape(-1,int(tmp2.shape[0]/2)) + +print('tmp1.shape',tmp1.shape) +print('tmp1.shape[0]',tmp1.shape[0]) +print('tmp2.shape',tmp2.shape) +print('tmp2.shape[0]',tmp2.shape[0]) + +# np.take(a, np.where(a>100)[0], axis=0) +# tmp1 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = a2[np.where(a1*a2 >= 0)] + +# tmp1 = a1[a1*a2 >= 0] +# tmp2 = a2[a1*a2 >= 0] + + +# tmp1_pos = a1[np.where(a1*a2 >= 0) ] +# tmp2_pos = a2[np.where(a1*a2 >= 0) ] +# tmp1_pos = tmp1_pos[np.where(tmp1_pos >= 0)] +# tmp2_pos = tmp2_pos[np.where(tmp2_pos >= 0)] + +# tmp1_neg = a1[a1*a2 >= 0 ] +# tmp2_neg = a2[a1*a2 >= 0 ] +# tmp1_neg = tmp1_neg[tmp1_neg < 0] +# tmp2_neg = tmp2_neg[tmp2_neg < 0] +# a1 = tmp1 +# a2 = tmp2 +# +# a1 = a1.reshape(-1,5) +# a2 = a2.reshape(-1,5) + +# tmp1_pos = tmp1_pos.reshape(-1,5) +# tmp2_pos = tmp2_pos.reshape(-1,5) +# tmp1_neg = tmp1_neg.reshape(-1,5) +# tmp2_neg = tmp2_neg.reshape(-1,5) + + +# print('a1:', a1) +# print('a2:',a2 ) +# print('a1.shape', a1.shape) + + + + + +energyVec = np.vectorize(energy) + +# Z = energyVec(np.array([a1,a2]),q1,q2,q12,q3,b1,b2) +# Z = energyVec(a1,a2,q1,q2,q12,q3,b1,b2) +# +# Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) + + + + +# Z = (tmp2**2)/tmp1 +Z = np.sqrt(tmp1*tmp2) + + +Z1 = np.sqrt(X_1*Y_1) +Z2 = np.sqrt(X_2*Y_2) + +# Z_bar = np.sqrt(abar[0,:]*abar[1,:]) +Z_bar = (abar[0,:]*abar[1,:])**0.5*abar + +abar = abar.T + + + +v1 = abar[0,:] +v2 = abar[1,:] + +# print('a1:', a1) +# print('a2:',a2 ) +# print('a1.shape', a1.shape) + + +evaluateVec = np.vectorize(evaluate) +Z_bar = evaluateVec(abar[0,:],abar[1,:]) +# Z = np.sqrt(np.multiply(tmp1,tmp2)) +# Z = np.sqrt(a1*a2) + + +print('v1.shape', v1.shape) +print('v1', v1) + + + + +print('Z:', Z) +print('Z_bar:', Z_bar) +# print('any', np.any(Z<0)) + +# + + +# negZ_a1 = a1[np.where(Z<0)] +# negZ_a2 = a2[np.where(Z<0)] +# negativeValues = Z[np.where(Z<0)] +# print('negativeValues:',negativeValues) +# +# print('negZ_a1',negZ_a1) +# print('negZ_a2',negZ_a2) +# +# +# negZ_a1 = negZ_a1.reshape(-1,5) +# negZ_a2 = negZ_a2.reshape(-1,5) +# negativeValues = negativeValues.reshape(-1,5) +# +# Z_pos = energyVec(tmp1_pos,tmp2_pos,q1,q2,q12,q3,b1,b2) +# Z_neg = energyVec(tmp1_neg,tmp2_neg,q1,q2,q12,q3,b1,b2) + + + + + +# print('Test energy:' , energy(np.array([1,1]),q1,q2,q12,q3,b1,b2)) + + + + +# print('Z_pos.shape', Z_pos.shape) + + + + + + + +## -- PLOT : +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + +label_size = 8 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +# plt.style.use('seaborn') +plt.style.use('seaborn-whitegrid') +# sns.set() +# plt.style.use('seaborn-whitegrid') + +label_size = 9 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +width = 6.28 *0.5 +# width = 6.28 +height = width / 1.618 +height = width +fig = plt.figure() + +ax = plt.axes(projection ='3d', adjustable='box') +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) +ax.grid(True,which='major',axis='xy',alpha=0.3) +# ax.grid(False,which='major',alpha=0.3) +# Hide grid lines +# ax.grid(False) + + + +# colorfunction=(B*kappa) +# print('colofunction',colorfunction) + +#translate Data +# Z = Z - (Z.max()-Z.min())/2 +# Z = Z - 50 +# Z = Z - 500 +# +# Z = Z.T + + +# Substract constant: +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c + +# print('Value of c:', c) + + + +# print('Z.min()', Z.min()) +# print('Z.max()', Z.max()) +# norm=mcolors.Normalize(Z.min(),Z.max()) +# facecolors=cm.brg(norm) + + +# print('norm:', norm) +# print('type of norm', type(norm)) +# print('norm(0):', norm(0)) +# print('norm(Z):', norm(Z)) + +# ax.plot(theta_rho, theta_values, 'royalblue', zorder=3, ) + +# ax.scatter(a1,a2, s=0.5) + +# ax.scatter(tmp1_pos,tmp2_pos, s=0.5) +# ax.scatter(tmp1_neg,tmp2_neg, s=0.5) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=100 ) +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=20 ) + + +# sns.kdeplot(np.array([a1, a2, Z])) +# sns.kdeplot(tmp1_pos,tmp2_pos,Z_pos) + +# levels = [-5.0, -4, -3, 0.0, 1.5, 2.5, 3.5] +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, corner_mask=True,levels=levels) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot(norm(Z)), corner_mask=True) +# CS = ax.contour(a1, a2, Z, cm.brg(norm(Z)), levels=20) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot, levels=20) +# CS = ax.contour(a1, a2, Z, colors='k', levels=14, linewidths=(0.5,)) +# CS = ax.contour(a1, a2, Z, colors='k', levels=18, linewidths=(0.5,)) + +# ax.contour(negZ_a1, negZ_a2, negativeValues, colors='k', linewidths=(0.5,)) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.5,)) + + + +# df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) +# df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), +# columns=['a', 'b', 'c']) + + + + +# sns.kdeplot(data=df2, x="waiting", y="duration") +# sns.kdeplot(data=df2) + +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.5,)) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k', extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k') +# +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, levels=10 ) +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, corner_mask=True) +# +# CS = ax.contour(a1, a2, Z,10, colors = 'k') +# ax.clabel(CS, inline=True, fontsize=4) + + +# cmap = cm.brg(norm(Z)) +# +# C_map = cm.inferno(norm(Z)) + +# ax.imshow(Z, cmap=C_map, extent=[-20, 20, -20, 20], origin='lower', alpha=0.5) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20], origin='lower', +# cmap='bwr', alpha=0.8) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', vmin=Z.min(), vmax=Z.max(), +# cmap='bwr', alpha=0.6) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + + +cmap=mpl.cm.RdBu_r +# cmap=mpl.cm.viridis_r +cmap=mpl.cm.bwr +# # cmap=mpl.cm.coolwarm +# # cmap=mpl.cm.gnuplot +# cmap=mpl.cm.viridis +# cmap=mpl.cm.inferno +cmap=mpl.cm.Blues +# cmap=mpl.cm.magma +# cmap=mpl.cm.cividis +# cmap=mpl.cm.gnuplot +# cmap=mpl.cm.gnuplot +cmap = mpl.colors.ListedColormap(["royalblue"], name='from_list', N=None) +# m = cm.ScalarMappable(norm=norm, cmap=cmap) +# m = cm.ScalarMappable(cmap=cmap) + +# cmap = cm.brg(Z) +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap='coolwarm', alpha=0.6) +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap=cmap, alpha=0.6) + +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', +# cmap=cmap, alpha=0.6) + +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + + + +# COLORBAR : +# cbar = plt.colorbar() +# cbar.ax.tick_params(labelsize=8) + + + + +# ##----- ADD RECTANGLE TO COVER QUADRANT : +# epsilon = 0.4 +# epsilon = 0.1 +# # ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# # ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# # ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color='gray', zorder=5)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color='gray', zorder=5)#yellow + + + +#### LINE SEGMENTS : +line = ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=2, color='coral', zorder=5) +# line = ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=2, color='coral', zorder=1) +# print('abar', abar) +# print('abar.shape',abar.shape) +# start = np.array([abar[0,499],abar[1,499],Z_bar[499]]) +# end = np.array([abar[0,500],abar[1,500],Z_bar[500]]) +# idx = np.where(np.round(Z_bar,3) == np.round( 0.02823972,3) ) +# print('idx[0][0]', idx[0][0]) +# line = ax.plot(abar[0,idx[0][0]:-1],abar[1,idx[0][0]:-1],Z_bar[idx[0][0]:-1], linewidth=2, color='coral', zorder=5) +### ----------------------------------- + + + + + +# ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + +# ax.plot_surface(tmp1,tmp2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + +# ax.scatter(X_1,Y_1,Z1, s=0.2) +# ax.scatter(X_2,Y_2,Z2, s=0.2) + + +# X = np.concatenate((X_1, X_2), axis=0) +# Y = np.concatenate((Y_1, Y_2), axis=0) +# Z = np.concatenate((Z1, Z2), axis=0) +# ax.plot_surface(X,Y,Z) + + +ax.plot_surface(X_1,Y_1,Z1 ,cmap=cmap, + linewidth=0, antialiased=True,alpha=.35, zorder=5) +ax.plot_surface(X_2,Y_2,Z2 ,cmap=cmap, + linewidth=0, antialiased=True,alpha=.35, zorder=5) +# ax.plot_surface(X_1,Y_1,Z1 , facecolor = 'lightblue', #cmap=cmap, +# linewidth=0, antialiased=True, alpha=1, zorder=5) +# ax.plot_surface(X_2,Y_2,Z2 , facecolor = 'lightblue', edgecolor='none', #cmap=cmap, +# linewidth=0, antialiased=True, alpha=1, zorder=5) + +# ax.plot_surface(X_1,Y_1,Z1 , #color='C0', +# rstride=1, cstride=1,linewidth=0, antialiased=True, alpha=1, zorder=5) + + + + +# ax.plot_surface(X_2,Y_2,Z2 , #color='C0', +# rstride=1, cstride=1,linewidth=0, alpha=0.8, zorder=5, shade=True) +# ax.plot_surface(X_2,Y_2,Z2) + +# X_2 = X_2.reshape(-1,1).flatten() +# Y_2 = Y_2.reshape(-1,1).flatten() +# Z2 = Z2.reshape(-1,1).flatten() +# +# ax.plot_trisurf(X_2,Y_2,Z2, color='blue' ) + + +# X_1 = X_1.reshape(-1,1).flatten() +# Y_1 = Y_1.reshape(-1,1).flatten() +# Z1 = Z1.reshape(-1,1).flatten() +# ax.plot_trisurf(X_1,Y_1,Z1 , color='blue') + + +### MAYAVI TEST +# mlab.figure(bgcolor=(1.0, 1.0, 1.0), size=(1000,1000)) +# mlab.view(azimuth=90, elevation=125) +# mlab.view(azimuth=100, elevation=115) +# axes = mlab.axes(color=(0, 0, 0), nb_labels=5) +# mlab.orientation_axes() +# mlab.mesh(X_1, Y_1,Z1, color=(0,0,1) , transparent=True ) +# mlab.plot3d(abar[0,:],abar[1,:],Z_bar, line_width=1) +# mlab.mesh(X_2, Y_2,Z2) +# mlab.savefig("./example.png") +### -------------------------------------------- + + + +# ax.plot_surface(X_1,Y_1,Z1 , cmap=cmap, +# linewidth=0, antialiased=False,alpha=1, zorder=5) +# ax.plot_surface(X_2,Y_2,Z2 , cmap=cmap, +# linewidth=0, antialiased=True,alpha=1, zorder=5) + +# ax.plot_surface(X_2,Y_2,Z2 , color = 'lightblue', #cmap=cmap, +# linewidth=0, antialiased=True, alpha=1, zorder=5) + + +# ax.plot(G[0,:],G[1,:],G[2,:]) +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=2, color='yellow', linestyle='--') +# ax.scatter(abar[0,:],abar[1,:],Z_bar, color='purple', zorder=5) +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=2, color='royalblue', linestyle='--') +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=3, color='dodgerblue', linestyle='--') +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=3, color='cornflowerblue', linestyle='--') +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=3, color='darkorange', linestyle='--') +# ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=3, color='yellow', linestyle='--') +# line = ax.plot(abar[0,:],abar[1,:],Z_bar, linewidth=1, color='coral', linestyle='--', zorder=3) + + +# plot starting point: +# ax.scatter(abar[0,0],abar[1,0],Z_bar[0], marker='^', s=30, color='black', zorder=5) +# +# +# ax.scatter(abar[0,500],abar[1,500],Z_bar[500], marker='^', s=30, color='purple', zorder=5) + +# ax.scatter(start[0],start[1],start[2], marker='^', s=30, color='purple', zorder=5) +# ax.scatter(end[0],end[1],end[2], marker='^', s=30, color='purple', zorder=5) + + +# define origin +o = np.array([0,0,0]) + +start = np.array([1,0,0]) +end = np.array([2.5,0,0]) + + +print('start:', start) +print('end:', end) + + +dir = end-start +print('dir:', dir) +# ax.arrow() + +# ax.arrow3D(start[0],start[1],start[2], +# dir[0],dir[1],dir[2], +# mutation_scale=10, +# arrowstyle="->", +# linestyle='dashed',fc='coral', +# lw = 1, +# ec ='coral', +# zorder=3) + +# ax.arrow3D(midpoint_mapped[0],midpoint_mapped[1],midpoint_mapped[2], +# normal[0],normal[1],normal[2], +# mutation_scale=15, +# lw = 1.5, +# arrowstyle="-|>", +# linestyle='dashed',fc='blue', +# ec ='blue', +# zorder = 5) + + +# ax.arrow3D(start[0],start[1],start[2], +# dir[0],dir[1],dir[2], +# mutation_scale=20, +# arrowstyle="->", +# fc='coral', +# lw = 1, +# ec ='coral', +# zorder=3) +# ax.arrow3D(start[0],start[1],start[2], +# dir[0],dir[1],dir[2], +# mutation_scale=20, +# arrowstyle="->", +# fc='coral', +# lw = 1, +# ec ='coral', +# zorder=3) + +arrow_prop_dict = dict(mutation_scale=20, arrowstyle='-|>', color='k', shrinkA=0, shrinkB=0) +# style = ArrowStyle('Fancy', head_length=1, head_width=1.5, tail_width=0.5) + + +# ADD ARROW: +# a = Arrow3D([start[0], end[0]], [start[1], end[1]], [start[2], end[2]], mutation_scale=15, arrowstyle='-|>', color='darkorange') +# ax.add_artist(a) + +## ADD Annotation +ax.text(0, 0, 1.5, r"$\mathcal G^+$", color='royalblue', size=12) +# ax.text(0.5, 0.5, "Test") +# ax.text(9, 0, 0, "red", color='red') + +### ---- Check proof: +# value at t = 0: +abar_zero= sstar*abar_tmp +# value_0 = [abar_zero[0], abar_zero[1] , (2*abar_zero[0]*abar_zero[1])**0.5 ] +value_0 = evaluate(abar_zero[0], abar_zero[1]) +print('value_0', value_0) +# ax.scatter(value_0[0],value_0[1],value_0[2], marker='x', s=20, color='dodgerblue', zorder=5) +# ax.scatter(abar_zero[0], abar_zero[1],value_0, marker='o', s=30, color='dodgerblue', zorder=5) +## ----------------------------- + + + + + + + + + + +# ax.scatter(tmp1,tmp2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) +# ax.plot_surface(tmp1,Z, tmp2, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) +# ax.plot_trisurf(tmp1,tmp2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + + +# ax.plot(theta_rho, energy_axial1, 'royalblue', zorder=3, label=r"axialMin1") +# ax.plot(theta_rho, energy_axial2, 'forestgreen', zorder=3, label=r"axialMin2") +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) + + + + +# lg = ax.legend(bbox_to_anchor=(0.0, 0.75), loc='upper left') + + + + +### PLOT X AND Y AXIS: +# ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=0.5) +# ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5) +ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=1 ,zorder=5) +ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=1) + + + +# Plot 1-Parameter Line +line_values= np.array(line_values) +ax.plot(line_values[:,0],line_values[:,1],'k--', linewidth=1,color='orange',alpha=0.8) + + +ax.set_xlabel(r"$a_1$", fontsize=10 ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=10 ,labelpad=0) + + +# ax.get_xaxis().set_visible(False) +# ax = plt.gca(projection="3d") +# ax._axis3don = False +ZL = ax.get_zgridlines() + +# ax.set_ylabel(r"energy") + + +# ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax.set_yticklabels(labels) + + + + + +# ax.legend(loc='upper right') + + + +fig.set_size_inches(width, height) +fig.savefig('1-ParameterFamily_G+.pdf') + +plt.show() diff --git a/src/CylindricalMinimizer-Plot.py b/src/CylindricalMinimizer-Plot.py index 2ebff75f98a1dceabcd561acbab48edcff160de7..11f72c14e1a2274f153d421b6ff4e1e826e1d37d 100644 --- a/src/CylindricalMinimizer-Plot.py +++ b/src/CylindricalMinimizer-Plot.py @@ -201,8 +201,8 @@ num_Points = 100 e = np.array([1,0]) -# e = np.array([0,1]) -e = np.array([1/np.sqrt(2),1/np.sqrt(2)]) +e = np.array([0,1]) +# e = np.array([1/np.sqrt(2),1/np.sqrt(2)]) # e = np.array([1/2,np.sqrt(3)/2]) # e = np.array([np.sqrt(3)/2,1/2]) # e = np.array([-1,0]) diff --git a/src/Energy_ContourG+_plotly.py b/src/Energy_ContourG+_plotly.py index b78b75616477e1d18423e3be67310b9133315755..6b41b5ff3cac652b4880ea70515d723bb5fe3362 100644 --- a/src/Energy_ContourG+_plotly.py +++ b/src/Energy_ContourG+_plotly.py @@ -27,7 +27,8 @@ import matplotlib.colors as mcolors from chart_studio import plotly import plotly.graph_objs as go - +from plotly.subplots import make_subplots +import plotly.io as pio # from matplotlib import rc # rc('text', usetex=True) # Use LaTeX font # @@ -45,6 +46,41 @@ def show(fig): img.show() +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + # set the colormap and centre the colorbar @@ -559,31 +595,128 @@ print('norm(Z):', norm(Z)) CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.5,),zorder=5) -# fig = go.Figure(data = go.Contour(Z_in, a1_in, a2_in)) -fig = go.Figure(data = go.Contour(x = x_in, y = y_in, z = Z_in, +## PLOTLY: + +fig = make_subplots(specs=[[{"secondary_y": True}]]) + + +data1 = go.Contour(x = x_in, y = y_in, z = Z_in, # colorscale='Electric', colorscale='agsunset', contours=dict( coloring ='heatmap', showlabels = True, # show labels on contours labelfont = dict( # label font properties - size = 12, + size = 14, color = 'white', ) ), line_width=2 ,line_smoothing=0.85, - colorbar=dict( - title='Color bar title', # title here - titleside='right', - titlefont=dict( - size=14, - family='Arial, sans-serif') + # colorbar=dict( + # title='Color bar title', # title here + # titleside='right', + # titlefont=dict( + # size=14, + # family='Arial, sans-serif') + # ) + + ) - )) +epsilon = 0.4 +epsilon = 0.1 +# data2 = go.Scatter(x=[0+epsilon,x.max(),x.max(), 0+epsilon], y=[0-epsilon,0-epsilon,y.min(),y.min()], fill="toself") +data2 = go.Scatter(x=[0+epsilon,x.max(),x.max(), 0+epsilon], y=[0-epsilon,0-epsilon,y.min(),y.min()]) + +# data_tmp = [data1,data2] +data_tmp = [data1] + +fig = go.Figure(data = data_tmp) + +# ADD RECTANGLES: +fig.add_shape(type="rect", + x0=0+epsilon, y0=0-epsilon, x1=x.max(), y1=y.min(), + line=dict( + color="White", + width=1, + ), + fillcolor="White", + opacity=0.75 +) +fig.add_shape(type="rect", + x0=x.min(), y0=0+epsilon, x1=0-epsilon, y1=y.max(), + line=dict( + color="White", + width=1 + ), + fillcolor="White", + opacity=0.75 +) + + +# ADD COORDINATE LINES + +fig.add_shape(type="line", + x0=x.min(), y0=0, x1=x.max(), y1=0, + line=dict( + color="black", + width=2, + dash="dash", + ) +) + +fig.add_shape(type="line", + x0=0, y0=y.min(), x1=0, y1=y.max(), + line=dict( + color="black", + width=2, + dash="dash", + ) +) + +# fig = go.Figure(data = go.Contour(Z_in, a1_in, a2_in)) +# fig = go.Figure(data = go.Contour(x = x_in, y = y_in, z = Z_in, +# # colorscale='Electric', +# colorscale='agsunset', +# contours=dict( +# coloring ='heatmap', +# showlabels = True, # show labels on contours +# labelfont = dict( # label font properties +# size = 12, +# color = 'white', +# ) +# ), line_width=2 ,line_smoothing=0.85, +# # colorbar=dict( +# # title='Color bar title', # title here +# # titleside='right', +# # titlefont=dict( +# # size=14, +# # family='Arial, sans-serif') +# # ) +# ) +# ) + +epsilon = 0.4 +epsilon = 0.1 +# ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow + +# fillcolor = 'white' +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow + + +# trace2 = go.Figure(go.Scatter(x=[0+epsilon,x.max(),x.max(), 0+epsilon], y=[0-epsilon,0-epsilon,y.min(),y.min()], fill="toself")) +# fig.add_trace(trace1) + +# fig.add_trace(trace1) +# fig.add_trace(trace2.data[0],secondary_y=True) fig.update_layout( autosize=False, - width=500, - height=500, + # width=500, + # height=500, + width=300, + height=300, # margin=dict( # l=50, # r=50, @@ -594,12 +727,21 @@ fig.update_layout( # paper_bgcolor="LightSteelBlue", ) +width = 452.9579/2 +size= set_size(width, fraction=0.5) +print('set_size(width, fraction=0.5)', set_size(width, fraction=0.5)) +print('size[0]',size[0]) + + # fig.show() -show(fig) +# show(fig) # fig.write_image("Plotly-fig1.png", width=width, height=height, scale=1) fig.write_image("Plotly-fig1.png") - +# pio.write_image(fig, "test.svg", width=6.28 *0.33*300, height=6.28 *0.33*300, scale=1) +# pio.write_image(fig, "test.png", width=6.28*0.33*300, height=6.28*0.33*300) +pio.write_image(fig, "test.pdf", width=6.28*0.33*300, height=6.28*0.33*300) +# pio.write_image(fig, "test.pdf", width=width, height=width) # df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) # df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), # columns=['a', 'b', 'c']) diff --git a/src/Energy_ContourG+_v2.py b/src/Energy_ContourG+_v2.py index 07d3ef51386c790ef63a23ecbbe8c841fea73939..c3aa2f0781977c157b65ca51c028ed948dcf44af 100644 --- a/src/Energy_ContourG+_v2.py +++ b/src/Energy_ContourG+_v2.py @@ -27,7 +27,8 @@ import matplotlib.colors as mcolors from chart_studio import plotly import plotly.graph_objs as go - +import plotly.express as px +import plotly.colors # from matplotlib import rc # rc('text', usetex=True) # Use LaTeX font # @@ -66,6 +67,42 @@ class MidpointNormalize(mcolors.Normalize): +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + + def format_func(value, tick_number): # find number of multiples of pi/2 # N = int(np.round(2 * value / np.pi)) @@ -113,6 +150,31 @@ def find_nearestIdx(array, value): + +def check_case(q1,q2,q12,q3,b1,b2): + + # a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + print('det(H)=', np.linalg.det(H)) + + # check if g* is in G^*_R^2 + tmp = A.dot(b) + + ## compute inverse of H : + inv_H = np.linalg.inv(H) + + g_star = inv_H.dot(tmp) + + print('g_star=', g_star) + + + return g_star + + def energy(a1,a2,q1,q2,q12,q3,b1,b2): @@ -241,6 +303,15 @@ beta = 5.0 + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = -0.75 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + # mu1 = 1.0 # rho1 = 1.0 # alpha = 2.0 @@ -263,7 +334,7 @@ beta = 5.0 #set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value gamma = '0' -gamma = 'infinity' +# gamma = 'infinity' lambda1 = 0.0 @@ -297,27 +368,22 @@ b1 = prestrain_b1(rho1,beta, alpha, theta ) b2 = prestrain_b2(rho1,beta, alpha, theta ) -# 1-ParameterFamilyCase: - -q1=1; -q2=2; -q12=1/2; -q3=((4*q1*q2)**0.5-q12)/2; -# H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; - -H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) -A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) -abar = np.array([q12+2*q3, 2*q2]) -abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar - -print('abar:',abar) - -b = np.linalg.lstsq(A, abar)[0] -print('b',b) - -b1=b[0] -b2=b[1] - +## ---- 1-ParameterFamilyCase: +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# print('abar:',abar) +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# b1=b[0] +# b2=b[1] +## --------------- @@ -329,8 +395,20 @@ print('q12 = ', q12) print('b1 = ', b1) print('b2 = ', b2) +## --- CHECK CASE --- + + +g_star = check_case(q1,q2,q12,q3,b1,b2) + + + + + + +## ------------------------------------- + num_Points = 400 -# num_Points = 200 +num_Points = 200 # num_Points = 20 @@ -341,6 +419,9 @@ y = np.linspace(-5,5,num_Points) x = np.linspace(-20,20,num_Points) y = np.linspace(-20,20,num_Points) + +x = np.linspace(-2,2,num_Points) +y = np.linspace(-2,2,num_Points) # x = np.linspace(-10,10,num_Points) # y = np.linspace(-10,10,num_Points) @@ -354,11 +435,12 @@ y = np.linspace(-20,20,num_Points) a1, a2 = np.meshgrid(x,y) -geyser = sns.load_dataset("geyser") -print('type of geyser:', type(geyser)) -print('geyser:',geyser) +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) -ContourRange=20 +# ContourRange=20 +ContourRange=2 x_in = np.linspace(-ContourRange,ContourRange,num_Points) y_in = np.linspace(-ContourRange,ContourRange,num_Points) @@ -406,9 +488,9 @@ tmp2 = tmp2.reshape(-1,5) # tmp2_neg = tmp2_neg.reshape(-1,5) -print('a1:', a1) -print('a2:',a2 ) -print('a1.shape', a1.shape) +# print('a1:', a1) +# print('a2:',a2 ) +# print('a1.shape', a1.shape) @@ -425,7 +507,6 @@ Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) print('Z:', Z) - print('any', np.any(Z<0)) # @@ -483,12 +564,26 @@ mpl.rcParams['xtick.labelsize'] = label_size mpl.rcParams['ytick.labelsize'] = label_size width = 6.28 *0.5 +# width = 6.28 *0.33 # width = 6.28 -height = width / 1.618 -fig = plt.figure() - +height = width #/ 1.618 + +# width = 452.9579/2 +# size= set_size(width, fraction=0.5) +# print('set_size(width, fraction=0.5)', set_size(width, fraction=1)) +# print('size[0]',size[0]) + +f_size = 8 +# fig= plt.figure() +fig, ax = plt.subplots() +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.5)) # ax = plt.axes(projection ='3d', adjustable='box') -ax = plt.axes((0.17,0.21 ,0.75,0.75)) +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) + +# ax = plt.axes((0.17,0.23 ,0.7,0.7)) +# ax = plt.axes((0.17,0.23 ,1.0,1.0)) +# ax=plt.axes() # ax = plt.axes((0.15,0.18,0.8,0.8)) # ax.tick_params(axis='x',which='major', direction='out',pad=5) # ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) @@ -513,10 +608,10 @@ ax = plt.axes((0.17,0.21 ,0.75,0.75)) # Substract constant: -c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 -Z = Z-c - -print('Value of c:', c) +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c +# +# print('Value of c:', c) @@ -554,17 +649,24 @@ print('norm(Z):', norm(Z)) # CS = ax.contour(a1, a2, Z, colors='k', levels=18, linewidths=(0.5,)) # ax.contour(negZ_a1, negZ_a2, negativeValues, colors='k', linewidths=(0.5,)) -CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.5,),zorder=5) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75) ,zorder=5) +step = (-1)*Z.min() -# df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) -# df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), -# columns=['a', 'b', 'c']) +levels = np.arange(Z.min(),Z.max()/2,step) +levels = np.arange(Z.min(),Z.max()/12,step) +# levels = np.arange(0,Z.max()/2,200) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75), levels=levels ,zorder=5) +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.75), levels=levels ,zorder=5) +CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(1) , vmin= Z.min()+0.04, zorder=5) +# df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) +# df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), +# columns=['a', 'b', 'c']) # sns.kdeplot(data=df2, x="waiting", y="duration") # sns.kdeplot(data=df2) @@ -579,8 +681,32 @@ CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.5,),zorder=5) # # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, corner_mask=True) # # CS = ax.contour(a1, a2, Z,10, colors = 'k') -ax.clabel(CS, inline=True, fontsize=4) +# ax.clabel(CS, inline=True, fontsize=4) +# ax.clabel(CS, inline=True, fontsize=4) + + +# 1- ParameterFAMILY CASE : +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ),(-12.5,-12.5),(-14,-14), (-15,-15), +# (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + + + +# GAMMA = inf +manual_locations = [ + (1, 1), (-5, -5), (-10, -10 ), (-15,-15), + (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + +# +# +# # GAMMA = 0 +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ), (-15,-15), (-15,7), +# (5, 5), (10, 10 ), (15,15), (17,17)] + +# ax.clabel(CS, inline=True, fontsize=f_size, colors='black', manual=manual_locations) +ax.clabel(CS, inline=True, fontsize=f_size, colors='black') # cmap = cm.brg(norm(Z)) # @@ -601,24 +727,43 @@ ax.clabel(CS, inline=True, fontsize=4) cmap=mpl.cm.RdBu_r cmap=mpl.cm.viridis_r # cmap=mpl.cm.bwr -# cmap=mpl.cm.coolwarm -cmap=mpl.cm.gnuplot -# cmap=mpl.cm.cividis +cmap=mpl.cm.coolwarm +# cmap=mpl.cm.gnuplot +cmap=mpl.cm.magma_r +# cmap=mpl.cm.inferno_r +# cmap=mpl.cm.plasma +# cmap=mpl.cm.plasma_r +# cmap=mpl.cm.cividis_r # cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","violet","red"]) # cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","orange"]) # cmap = mpl.colors.LinearSegmentedColormap.from_list("", [(0,"red"), (.1,"violet"), (.5, "blue"), (1.0, "green")]) +# make a colormap that has land and ocean clearly delineated and of the +# same length (256 + 256) +# +# colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256)) +# colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256)) +# all_colors = np.vstack((colors_undersea, colors_land)) +# # cmap = mcolors.LinearSegmentedColormap.from_list( +# # 'terrain_map', all_colors) + + +# cmap = px.colors.sequential.agsunset +# cmap = plotly.colors.PLOTLY_SCALES["Viridis"] + + # cmap = cm.brg(Z) divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=(Z.max()+Z.min())/2, vmax=Z.max()) -divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0, vmax=Z.max()) +# divnorm=mcolors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=Z.max()) + # divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0. ,vmax=10) # divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0., vmax=Z.max()) - +# divnorm=mcolors.LogNorm(vmin=Z.min(), vmax=Z.max()) #Test LogNorm # cmap = cm.brg(divnorm(Z)) @@ -634,8 +779,17 @@ divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0, vmax=Z.max()) # plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', # cmap=cmap, alpha=0.6) -I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, - cmap=cmap, alpha=0.6) +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) +plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, + cmap=cmap, alpha=0.9) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', + # cmap=cmap, alpha=0.6) + # I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = mcolors.CenteredNorm(), # cmap=cmap, alpha=0.6) @@ -644,7 +798,7 @@ I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', no # COLORBAR : # cbar = plt.colorbar() -# cbar.ax.tick_params(labelsize=6) +# cbar.ax.tick_params(labelsize=f_size) # fig.colorbar(I) @@ -659,8 +813,8 @@ epsilon = 0.2 fillcolor = 'white' # ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow # ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow -ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=1, color=fillcolor, zorder=4)#yellow -ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=1, color=fillcolor, zorder=4)#yellow +ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow +ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=1.0, color=fillcolor, zorder=4)#yellow # ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, # linewidth=0, antialiased=False) @@ -684,9 +838,17 @@ ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5) -ax.set_xlabel(r"$a_1$", fontsize=10 ,labelpad=0) -ax.set_ylabel(r"$a_2$", fontsize=10 ,labelpad=0) + +ax.scatter(g_star[0],g_star[1], s=20, zorder=5) +ax.text(g_star[0]+1,g_star[1]-1, r"$g_*$", color='royalblue', size=15, zorder = 5) + + +ax.set_xlabel(r"$a_1$", fontsize=f_size ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=f_size ,labelpad=0) # ax.set_ylabel(r"energy") +ax.tick_params(axis='both', which='major', labelsize=f_size) +ax.tick_params(axis='both', which='minor', labelsize=f_size) + # ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) @@ -702,6 +864,7 @@ ax.set_ylabel(r"$a_2$", fontsize=10 ,labelpad=0) fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.33)) fig.savefig('Energy_ContourG+.pdf') plt.show() diff --git a/src/Energy_ContourG+_v3.py b/src/Energy_ContourG+_v3.py new file mode 100644 index 0000000000000000000000000000000000000000..c829f2fa86d8c66116571ac95d6c6529840f21ae --- /dev/null +++ b/src/Energy_ContourG+_v3.py @@ -0,0 +1,1360 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +import seaborn as sns +import matplotlib.colors as mcolors + +from chart_studio import plotly +import plotly.graph_objs as go +import plotly.express as px +import plotly.colors +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def show(fig): + import io + import plotly.io as pio + from PIL import Image + buf = io.BytesIO() + pio.write_image(fig, buf) + img = Image.open(buf) + img.show() + + + + +# set the colormap and centre the colorbar +class MidpointNormalize(mcolors.Normalize): + """ + Normalise the colorbar so that diverging bars work there way either side from a prescribed midpoint value) + + e.g. im=ax1.imshow(array, norm=MidpointNormalize(midpoint=0.,vmin=-100, vmax=100)) + """ + def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): + self.midpoint = midpoint + mcolors.Normalize.__init__(self, vmin, vmax, clip) + + def __call__(self, value, clip=None): + # I'm ignoring masked values and all kinds of edge cases to make a + # simple example... + x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] + return np.ma.masked_array(np.interp(value, x, y), np.isnan(value)) + + + +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + + +def format_func(value, tick_number): + # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == -1: + # return r"$-\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + ##find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == -1: + return r"$-\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N == -2: + return r"$-\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + + +def check_case(q1,q2,q12,q3,b1,b2): + + # a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + print('det(H)=', np.linalg.det(H)) + + # check if g* is in G^*_R^2 + tmp = A.dot(b) + + ## compute inverse of H : + inv_H = np.linalg.inv(H) + + g_star = 2*inv_H.dot(tmp) + + print('g_star=', g_star) + + + return g_star + + +def get_gstar(q1,q2,q12,q3,b1,b2): + + # a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + print('det(H)=', np.linalg.det(H)) + # check if g* is in G^*_R^2 + tmp = A.dot(b) + ## compute inverse of H : + inv_H = np.linalg.inv(H) + g_star = 2*inv_H.dot(tmp) + # print('g_star=', g_star) + + return g_star + + +def determine_b(q1,q2,q12,q3,g_star): + ## + # Input: g_star + # Output : b such that g_star is minimizer, i.e A*b = (1/2)*H*g_star + # q1=1; + # q2=2; + # q12=1/2; + # q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + + + + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + rhs = (1/2)*H.dot(g_star) + print('rhs:', rhs) + b = np.linalg.lstsq(A, rhs)[0] + print('b',b) + b1=b[0] + b2=b[1] + + return b + ## --------------- + + +def get_minimizer(q1,q2,q3,b1,b2): + + # In the case if q12 == 0: + quotient = (q1*q2-q3**2) + g_star = np.array([(q1*q2*b1-q3*q2*b2)/quotient, (q1*q2*b2-q3*q1*b1)/quotient]) + print('g_star=', g_star) + return g_star + + +def energy(a1,a2,q1,q2,q12,q3,b1,b2): + + + a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + tmp = H.dot(a) + + # print('H',H) + # print('A',A) + # print('b',b) + # print('a',a) + # print('tmp',tmp) + + tmp = (1/2)*a.dot(tmp) + # print('tmp',tmp) + + tmp2 = A.dot(b) + # print('tmp2',tmp2) + tmp2 = 2*a.dot(tmp2) + + # print('tmp2',tmp2) + energy = tmp - tmp2 + # print('energy',energy) + + + # energy_axial1.append(energy_1) + + return energy + + + +# def energy(a1,a2,q1,q2,q12,q3,b1,b2): +# +# +# b = np.array([b1,b2]) +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a',a) +# print('tmp',tmp) +# +# tmp = (1/2)*a.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a.dot(tmp2) +# +# print('tmp2',tmp2) +# energy = tmp - tmp2 +# print('energy',energy) +# +# +# # energy_axial1.append(energy_1) +# +# return energy +# + + +def draw_1ParameterLine(q1,q2,q12,q3): + + # q1=1; + # q2=2; + # q12=1/2; + # q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + + print('abar:',abar) + + b = np.linalg.lstsq(A, abar)[0] + print('b',b) + + b1=b[0] + b2=b[1] + + + # print('abar:',np.shape(abar)) + # print('np.transpose(abar):',np.shape(np.transpose(abar))) + sstar = (1/(q1+q2))*abar.dot(A.dot(b)) + # sstar = (1/(q1+q2))*abar.dot(tmp) + print('sstar', sstar) + abarperp= np.array([abar[1],-abar[0]]) + print('abarperp:',abarperp) + + N=500; + scale_domain = 5 + translate_startpoint = -1.8 + scale_domain = 4.65 + translate_startpoint = -1.85 + # --- FUll LINE: + scale_domain = 4.5 + translate_startpoint = -1.4 + T_line = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) + line_values = [] + for t in T_line : + print('sstar*abar+t*abarperp', sstar*abar+t*abarperp) + line_values.append(sstar*abar+t*abarperp) + # ------ + + + T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) + # T = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) + # T = np.linspace(-2,2, num=N) + # print('T:', T) + + print('T.min():', T.min()) + print('T.max():', T.max()) + + kappas = [] + alphas = [] + # G.append(float(s[0])) + + G_container = [] + abar_container = [] + + + abar_tmp = abar + + for t in T : + abar_current = sstar*abar+t*abarperp; + abar_current[abar_current < 1e-10] = 0 # Project to x-y-axis!! + current_energy = energy(abar_current[0],abar_current[1],q1,q2,q12,q3,b1,b2) + print('energy along line:', current_energy ) + G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] + G_container.append(G) + abar_container.append(abar_current) + e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] + kappa = abar_current[0]+abar_current[1] + alpha = math.atan2(e[1], e[0]) + kappas.append(kappa) + alphas.append(alpha) + + + alphas = np.array(alphas) + kappas = np.array(kappas) + + # print('G_container', G_container) + G = np.array(G_container) + abar = np.array(abar_container) + + # print('G', G) + # print('abar', abar) + # print('abar.shape',abar.shape) + line = ax.plot(abar[:,0],abar[:,1], linewidth=2, color='royalblue', linestyle='-', zorder=4) + + # Plot 1-Parameter Line + line_values= np.array(line_values) + ax.plot(line_values[:,0],line_values[:,1],'k--', linewidth=1,color='royalblue',alpha=0.8,zorder=4) + + return line + + + + +################################################################################################################ +################################################################################################################ +################################################################################################################ + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') + +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# +# print('abar:',abar) +# +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# +# +# # print('abar:',np.shape(abar)) +# # print('np.transpose(abar):',np.shape(np.transpose(abar))) +# sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# # sstar = (1/(q1+q2))*abar.dot(tmp) +# print('sstar', sstar) +# abarperp= np.array([abar[1],-abar[0]]) +# print('abarperp:',abarperp) + + +# -------------------------- Input Parameters -------------------- +# +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 5.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 +# + + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = -0.75 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +#Figure3: +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/8 +# # theta= 0.1 +# beta = 2.0 + + +# alpha= -5 + + +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +# gamma = '0' +# # gamma = 'infinity' +# +# +# lambda1 = 0.0 + + +print('---- Input parameters: -----') +# print('mu1: ', mu1) +# print('rho1: ', rho1) +# # print('alpha: ', alpha) +# print('beta: ', beta) +# # print('theta: ', theta) +# print('gamma:', gamma) +# +# print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- +print('----------------------------') + +# ---------------------------------------------------------------- + + + + + + +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, alpha, theta ) +# b2 = prestrain_b2(rho1,beta, alpha, theta ) +# + + +case = 'a' +case = 'b' +# case = 'c' + + + +if case == 'a': + print('---- CASE (a) ----') + q1 = 1 + q2 = 2 + q12 = 0 + q3 = 1 + g_star = np.array([0,1]) + g_star = np.array([-1,1]) + # ToDO + b = determine_b(q1,q2,q12,q3, g_star) + b1 = b[0] + b2 = b[1] + + +if case == 'b': + print('---- CASE (b) ----') + q1 = 1 + q2 = 2 + q12 = 0 + q3 = 1 + g_star = np.array([1,1]) + # ToDO + b = determine_b(q1,q2,q12,q3, g_star) + b1 = b[0] + b2 = b[1] + + +if case == 'c': + print('---- CASE (c) ----') + ## ---- 1-ParameterFamilyCase: + q1=1; + q2=2; + q12=1/2; + q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + print('abar:',abar) + b = np.linalg.lstsq(A, abar)[0] + print('b',b) + b1=b[0] + b2=b[1] + ## --------------- + + + + +print('q1 = ', q1) +print('q2 = ', q2) +print('q3 = ', q3) +print('q12 = ', q12) +print('b1 = ', b1) +print('b2 = ', b2) + +## --- CHECK CASE --- + + +if case == 'a': + # Check Minimizers: + vec1 = np.array([(2*q1*b1+q12*b2)/(2*q1), 0]) + vec2 = np.array([0, (2*q12*b1+q2*b2)/(2*q2)]) + print('vec1:',vec1) + print('vec2:',vec2) + energy_1 = energy(vec1[0],vec1[1],q1,q2,q12,q3,b1,b2) + energy_2 = energy(vec2[0],vec2[1],q1,q2,q12,q3,b1,b2) + print('energy_1:',energy_1) + print('energy_2:',energy_2) + if energy_1 >= energy_2: + minvec = vec2 + else: + minvec = vec1 + print('minvec:', minvec) + + + + +check_case(q1,q2,q12,q3,b1,b2) + +g_star = get_gstar(q1,q2,q12,q3,b1,b2) +print('g_star:',g_star) + +# TEST +print('special case g_star:') +get_minimizer(q1,q2,q3,b1,b2) + + + + +## ------------------------------------- + +num_Points = 400 +# num_Points = 600 +# num_Points = 200 +# num_Points = 100 +# num_Points = 20 + + +# Creating dataset +x = np.linspace(-5,5,num_Points) +y = np.linspace(-5,5,num_Points) + +x = np.linspace(-20,20,num_Points) +y = np.linspace(-20,20,num_Points) + + +x = np.linspace(-2,2,num_Points) +y = np.linspace(-2,2,num_Points) +# x = np.linspace(-10,10,num_Points) +# y = np.linspace(-10,10,num_Points) + +# x = np.linspace(-60,60,num_Points) +# y = np.linspace(-60,60,num_Points) +# +# +# x = np.linspace(-40,40,num_Points) +# y = np.linspace(-40,40,num_Points) + + +a1, a2 = np.meshgrid(x,y) + +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) + +# ContourRange=20 +ContourRange=2 + +# x_in = np.linspace(-ContourRange,ContourRange,num_Points) +# y_in = np.linspace(-ContourRange,ContourRange,num_Points) +# a1_in, a2_in = np.meshgrid(x_in,y_in) + +print('a1:', a1) +print('a2:',a2 ) +print('a1.shape', a1.shape) + +#-- FILTER OUT VALUES for G+ : + +# tmp1 = a1[np.where(a1*a2 >= 0)] +# tmp2 = a2[np.where(a1*a2 >= 0)] +# +# np.take(a, np.where(a>100)[0], axis=0) +# tmp1 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = a2[np.where(a1*a2 >= 0)] + +tmp1 = a1[a1*a2 >= 0] +tmp2 = a2[a1*a2 >= 0] +tmp1 = tmp1.reshape(-1,5) +tmp2 = tmp2.reshape(-1,5) + + +# tmp1_pos = a1[np.where(a1*a2 >= 0) ] +# tmp2_pos = a2[np.where(a1*a2 >= 0) ] +# tmp1_pos = tmp1_pos[np.where(tmp1_pos >= 0)] +# tmp2_pos = tmp2_pos[np.where(tmp2_pos >= 0)] +# +# tmp1_neg = a1[a1*a2 >= 0 ] +# tmp2_neg = a2[a1*a2 >= 0 ] +# tmp1_neg = tmp1_neg[tmp1_neg < 0] +# tmp2_neg = tmp2_neg[tmp2_neg < 0] +# a1 = tmp1 +# a2 = tmp2 +# +# a1 = a1.reshape(-1,5) +# a2 = a2.reshape(-1,5) +# +# tmp1_pos = tmp1_pos.reshape(-1,5) +# tmp2_pos = tmp2_pos.reshape(-1,5) +# tmp1_neg = tmp1_neg.reshape(-1,5) +# tmp2_neg = tmp2_neg.reshape(-1,5) + + +# print('a1:', a1) +# print('a2:',a2 ) +# print('a1.shape', a1.shape) + + + + + +energyVec = np.vectorize(energy) + +# Z = energyVec(np.array([a1,a2]),q1,q2,q12,q3,b1,b2) +Z = energyVec(a1,a2,q1,q2,q12,q3,b1,b2) + +# Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) + + + + +print('Z:', Z) +print('any', np.any(Z<0)) + + + + + + + +# negZ_a1 = a1[np.where(Z<0)] +# negZ_a2 = a2[np.where(Z<0)] +# negativeValues = Z[np.where(Z<0)] +# print('negativeValues:',negativeValues) +# +# print('negZ_a1',negZ_a1) +# print('negZ_a2',negZ_a2) +# +# +# negZ_a1 = negZ_a1.reshape(-1,5) +# negZ_a2 = negZ_a2.reshape(-1,5) +# negativeValues = negativeValues.reshape(-1,5) +# +# Z_pos = energyVec(tmp1_pos,tmp2_pos,q1,q2,q12,q3,b1,b2) +# Z_neg = energyVec(tmp1_neg,tmp2_neg,q1,q2,q12,q3,b1,b2) + + + + + +# print('Test energy:' , energy(np.array([1,1]),q1,q2,q12,q3,b1,b2)) + + + + +# print('Z_pos.shape', Z_pos.shape) + + + + + + + +## -- PLOT : +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + +label_size = 8 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +# plt.style.use('seaborn') +# plt.style.use('seaborn-whitegrid') +# sns.set() +# plt.style.use('seaborn-whitegrid') + +label_size = 9 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +width = 6.28 *0.5 +# width = 6.28 *0.33 +# width = 6.28 +height = width #/ 1.618 + +# width = 452.9579/2 +# size= set_size(width, fraction=0.5) +# print('set_size(width, fraction=0.5)', set_size(width, fraction=1)) +# print('size[0]',size[0]) + +f_size = 10 +# fig= plt.figure() +fig, ax = plt.subplots() +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.5)) +# ax = plt.axes(projection ='3d', adjustable='box') +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) + +# ax = plt.axes((0.17,0.23 ,0.7,0.7)) +# ax = plt.axes((0.17,0.23 ,1.0,1.0)) +# ax=plt.axes() +# ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) + +# colorfunction=(B*kappa) +# print('colofunction',colorfunction) + +#translate Data +# Z = Z - (Z.max()-Z.min())/2 +# Z = Z - 50 +# Z = Z - 500 +# +# Z = Z.T + + +# Substract constant: +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c +# +# print('Value of c:', c) + + + +print('Z.min()', Z.min()) +print('Z.max()', Z.max()) +norm=mcolors.Normalize(Z.min(),Z.max()) +# facecolors=cm.brg(norm) + + + +print('norm:', norm) +print('type of norm', type(norm)) +print('norm(0):', norm(0)) +print('norm(Z):', norm(Z)) + +# ax.plot(theta_rho, theta_values, 'royalblue', zorder=3, ) + +# ax.scatter(a1,a2, s=0.5) + +# ax.scatter(tmp1_pos,tmp2_pos, s=0.5) +# ax.scatter(tmp1_neg,tmp2_neg, s=0.5) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=100 ) +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=20 ) + + +# sns.kdeplot(np.array([a1, a2, Z])) +# sns.kdeplot(tmp1_pos,tmp2_pos,Z_pos) + +# levels = [-5.0, -4, -3, 0.0, 1.5, 2.5, 3.5] +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, corner_mask=True,levels=levels) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot(norm(Z)), corner_mask=True) +# CS = ax.contour(a1, a2, Z, cm.brg(norm(Z)), levels=20) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot, levels=20) +# CS = ax.contour(a1, a2, Z, colors='k', levels=14, linewidths=(0.5,)) +# CS = ax.contour(a1, a2, Z, colors='k', levels=18, linewidths=(0.5,)) + +# ax.contour(negZ_a1, negZ_a2, negativeValues, colors='k', linewidths=(0.5,)) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75) ,zorder=5) + + +step = (-1)*Z.min() +# step = 3.0 + +levels = np.arange(Z.min(),Z.max()/2,step) +# evels = np.arange(-4, 25, 4) +# levels = np.arange(-3, 23, 4) + +# levels = np.arange(Z.min(),Z.max()/12,step) +# levels = np.arange(Z.min(),Z.max(),step) +# levels = np.arange(0,Z.max()/2,200) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75), levels=levels ,zorder=5) + +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.75), levels=levels ,zorder=5) +# CS = ax.contour(a1, a2, Z,5, colors='k', linewidths=(0.75) ,zorder=5, vmin=Z.min(), vmax=1) + +# CS = ax.contour(a1, a2, Z,5, colors='k', linewidths=(0.75) ,zorder=5, vmin=Z.min(), vmax=1) + +if case == 'b': + levels = np.arange(-4, 25, 4) + + +if case == 'a': + levels = np.arange(-1, 25, 5) # if g_star = [0 1] + levels = np.arange(0, 24, 4) # if g_star = [-1 1] +if case == 'c': + levels = np.arange(0, 25, 4) + +CS = ax.contour(a1, a2, Z,levels, colors='k',linewidths=(0.75), extent=(-2, 2, -2, 2), zorder=5) + + +# CS = ax.contour(a1 , a2 , Z, colors='k', linewidths=(0.75), zorder=5) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(1) , vmin= Z.min()+0.04, zorder=5) +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(1) , vmin= Z.min()+0.04, zorder=5) + + + +# df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) +# df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), +# columns=['a', 'b', 'c']) + +# sns.kdeplot(data=df2, x="waiting", y="duration") +# sns.kdeplot(data=df2) + +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.5,)) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k', extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k') +# +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, levels=10 ) +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, corner_mask=True) +# +# CS = ax.contour(a1, a2, Z,10, colors = 'k') +# ax.clabel(CS, inline=True, fontsize=4) + +# ax.clabel(CS, inline=True, fontsize=4) + + +# 1- ParameterFAMILY CASE : +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ),(-12.5,-12.5),(-14,-14), (-15,-15), +# (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + + +if case == 'c': + manual_locations = [ + (1, 1), (0.5, 0.5),(1.5,1.5),(1.75,1.75),(-0.2,0.2), (-0.5,-0.5), + (-1,-1),(-1.25,-1.25), (-1.5,-1.5)] + ax.clabel(CS, inline=True, fontsize=9, colors='black', manual=manual_locations) +else : + ax.clabel(CS, inline=True, fontsize=9, colors='black', zorder=5) + +# GAMMA = inf +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ), (-15,-15), +# (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + +# +# +# # GAMMA = 0 +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ), (-15,-15), (-15,7), +# (5, 5), (10, 10 ), (15,15), (17,17)] + + +# ax.clabel(CS, inline=True, fontsize=f_size, colors='black') +# ax.clabel(CS, inline=True, fontsize=9, colors='black', zorder=5) + +# cmap = cm.brg(norm(Z)) +# +# C_map = cm.inferno(norm(Z)) + +# ax.imshow(Z, cmap=C_map, extent=[-20, 20, -20, 20], origin='lower', alpha=0.5) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20], origin='lower', +# cmap='bwr', alpha=0.8) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', vmin=Z.min(), vmax=Z.max(), +# cmap='bwr', alpha=0.6) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + + +cmap=mpl.cm.RdBu_r +cmap=mpl.cm.viridis_r +# cmap=mpl.cm.bwr +cmap=mpl.cm.coolwarm +# cmap=mpl.cm.gnuplot +cmap=mpl.cm.magma_r +# cmap=mpl.cm.inferno_r +# cmap=mpl.cm.plasma +# cmap=mpl.cm.plasma_r +# cmap=mpl.cm.cividis_r +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","violet","red"]) +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","orange"]) + +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", [(0,"red"), (.1,"violet"), (.5, "blue"), (1.0, "green")]) +# make a colormap that has land and ocean clearly delineated and of the +# same length (256 + 256) +# +# colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256)) +# colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256)) +# all_colors = np.vstack((colors_undersea, colors_land)) +# # cmap = mcolors.LinearSegmentedColormap.from_list( +# # 'terrain_map', all_colors) + + +# cmap = px.colors.sequential.agsunset +# cmap = plotly.colors.PLOTLY_SCALES["Viridis"] + + + + + +# cmap = cm.brg(Z) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=(Z.max()+Z.min())/2, vmax=Z.max()) +# divnorm=mcolors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=Z.max()) + +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0. ,vmax=10) +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0., vmax=Z.max()) + +# divnorm=mcolors.LogNorm(vmin=Z.min(), vmax=Z.max()) #Test LogNorm + +# cmap = cm.brg(divnorm(Z)) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap='coolwarm', alpha=0.6) +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap=cmap, alpha=0.6) + +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', +# cmap=cmap, alpha=0.6) + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) +plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, + cmap=cmap, alpha=0.9) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', + # cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = mcolors.CenteredNorm(), +# cmap=cmap, alpha=0.6) + + + +# COLORBAR : +# cbar = plt.colorbar() +# cbar.ax.tick_params(labelsize=f_size) +# fig.colorbar(I) + + + +##----- ADD RECTANGLE TO COVER QUADRANT : +epsilon = 0.4 +epsilon = 0.2 +epsilon = 0.005 +epsilon = 0.01 +# ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow + +fillcolor = 'white' +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow +ax.fill_between([0+epsilon, x.max()-epsilon], y.min()+epsilon, 0-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow +ax.fill_between([x.min()+epsilon, 0-epsilon], 0+epsilon, y.max()-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow + +# ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, +# linewidth=0, antialiased=False) + + + +# ax.plot(theta_rho, energy_axial1, 'royalblue', zorder=3, label=r"axialMin1") +# ax.plot(theta_rho, energy_axial2, 'forestgreen', zorder=3, label=r"axialMin2") +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) + +if case == 'a': + # PLOT MINIMIZER g*: + # ax.scatter(g_star[0],g_star[1], s=20, zorder=5) + # ax.scatter(g_star[0],g_star[1], marker = 'x', s=20, zorder=5) + # ax.text(g_star[0]+0.1,g_star[1]-0.1, r"$g_*$", color='royalblue', size=15, zorder = 5) + ax.scatter(g_star[0],g_star[1], marker = 'x', s=40, color='gray', zorder=4) + ax.text(g_star[0]+0.15,g_star[1]-0.15, r"$g_*$", color='gray', size=12, alpha=0.8, zorder = 5) +if case == 'b': + # PLOT MINIMIZER g*: + ax.scatter(g_star[0],g_star[1], s=20, color='royalblue', zorder=5) + ax.scatter(g_star[0],g_star[1], marker = 'x', s=40, color='gray', zorder=4) + ax.text(g_star[0]+0.15,g_star[1]-0.15, r"$g_*$", color='gray', size=12, alpha=0.8, zorder = 5) +if case == 'c': + print('draw Line') + line = draw_1ParameterLine(q1,q2,q12,q3) + + +# lg = ax.legend(bbox_to_anchor=(0.0, 0.75), loc='upper left') + +if case == 'c': + # draw MINIMAL VALUES + print('np.where(Z == Z.min())',np.where(np.round(Z,6) == np.round(Z.min(),6))) + tmp_x = a1[np.where(np.round(Z,6) == np.round(Z.min(),6))] + tmp_y = a2[np.where(np.round(Z,6) == np.round(Z.min(),6))] + ax.scatter(tmp_x,tmp_y,color='red', zorder=5, s=1) + # ax.plot(tmp_x,tmp_y,color='forestgreen', zorder=5) + +# print('np.where(Z == Z.min())',np.where(np.round(Z,8) == np.round(Z.min(),8))) + + +if case == 'a': + ax.scatter(minvec[0],minvec[1],color='royalblue',zorder=5, s=20) + + +### PLot x and y- Axes +ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=0.5, zorder=4) +ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5, zorder=4) + + + + + + +ax.set_xlabel(r"$a_1$", fontsize=f_size ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=f_size ,labelpad=0) +# ax.set_ylabel(r"energy") +ax.tick_params(axis='both', which='major', labelsize=f_size) +ax.tick_params(axis='both', which='minor', labelsize=f_size) + + + +# ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax.set_yticklabels(labels) + + +# plt.subplots_adjust(left = 0.25 ) + + +# ax.legend(loc='upper right') + +fig.subplots_adjust(left=.18, bottom=.12, right=.90, top=.97) + +fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.33)) +Outputname = 'Energy_ContourG+_case'+ str(case) + '.pdf' +fig.savefig(Outputname) + +plt.show() + + +# +# +# +# # Curve parametrised by \theta_rho = alpha in parameter space +# N=100; +# theta_rho = np.linspace(1, 3, num=N) +# print('theta_rho:', theta_rho) +# +# +# theta_values = [] +# +# +# for t in theta_rho: +# +# s = (1.0/10.0)*t+0.1 +# theta_values.append(s) +# +# +# +# +# +# theta_rho = np.array(theta_rho) +# theta_values = np.array(theta_values) +# +# betas_ = 2.0 +# + +# alphas, betas, thetas = np.meshgrid(theta_rho, betas_, theta_values, indexing='ij') +# +# +# harmonicMeanVec = np.vectorize(harmonicMean) +# arithmeticMeanVec = np.vectorize(arithmeticMean) +# prestrain_b1Vec = np.vectorize(prestrain_b1) +# prestrain_b2Vec = np.vectorize(prestrain_b2) +# +# GetMuGammaVec = np.vectorize(GetMuGamma) +# muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# +# q1_vec = harmonicMeanVec(mu1, betas, thetas) +# q2_vec = arithmeticMeanVec(mu1, betas, thetas) +# +# b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) + +# special case: q12 == 0!! .. braucht eigentlich nur b1 & b2 ... + +# print('type b1_values:', type(b1_values)) + + + +# print('size(q1)',q1.shape) +# +# +# energy_axial1 = [] +# energy_axial2 = [] +# +# # for b1 in b1_values: +# for i in range(len(theta_rho)): +# print('index i:', i) +# +# print('theta_rho[i]',theta_rho[i]) +# print('theta_values[i]',theta_values[i]) +# +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta_values[i]) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta_values[i]) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta_values[i],gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, theta_rho[i],theta_values[i] ) +# b2 = prestrain_b2(rho1,beta, theta_rho[i],theta_values[i] ) +# +# +# # q2_vec = arithmeticMean(mu1, betas, thetas) +# # +# # b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# # b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) +# print('q1[i]',q1) +# print('q2[i]',q2) +# print('q3[i]',q3) +# print('b1[i]',b1) +# print('b2[i]',b2) +# # print('q1[i]',q1[0][i]) +# # print('q2[i]',q2[i]) +# # print('b1[i]',b1[i]) +# # print('b2[i]',b2[i]) +# #compute axial energy #1 ... +# +# a_axial1 = np.array([b1,0]) +# a_axial2 = np.array([0,b2]) +# b = np.array([b1,b2]) +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a_axial1) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial1',a_axial1) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial1.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial1.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_1 = tmp - tmp2 +# print('energy_1',energy_1) +# +# +# energy_axial1.append(energy_1) +# +# +# tmp = H.dot(a_axial2) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial2',a_axial2) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial2.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial2.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_2 = tmp - tmp2 +# print('energy_2',energy_2) +# +# +# energy_axial2.append(energy_2) +# +# +# +# +# +# print('theta_values', theta_values) +# +# +# + + +# +# +# +# +# kappas = [] +# alphas = [] +# # G.append(float(s[0])) +# +# +# +# +# for t in T : +# +# abar_current = sstar*abar+t*abarperp; +# # print('abar_current', abar_current) +# abar_current[abar_current < 1e-10] = 0 +# # print('abar_current', abar_current) +# +# # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] +# +# e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] +# kappa = abar_current[0]+abar_current[1] +# alpha = math.atan2(e[1], e[0]) +# +# print('angle current:', alpha) +# +# kappas.append(kappa) +# alphas.append(alpha) +# +# +# +# alphas = np.array(alphas) +# kappas = np.array(kappas) +# +# +# print('kappas:',kappas) +# print('alphas:',alphas) +# print('min alpha:', min(alphas)) +# print('min kappa:', min(kappas)) +# +# mpl.rcParams['text.usetex'] = True +# mpl.rcParams["font.family"] = "serif" +# mpl.rcParams["font.size"] = "9" +# width = 6.28 *0.5 +# height = width / 1.618 +# fig = plt.figure() +# # ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# # ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# # ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# # ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) +# +# +# +# +# ax.plot(alphas, kappas, 'royalblue', zorder=3, ) +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) diff --git a/src/Energy_ContourG+_v3_plotSurf.py b/src/Energy_ContourG+_v3_plotSurf.py new file mode 100644 index 0000000000000000000000000000000000000000..be4135569c928840b549648e86585ab94d2d6fc7 --- /dev/null +++ b/src/Energy_ContourG+_v3_plotSurf.py @@ -0,0 +1,1309 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +import seaborn as sns +import matplotlib.colors as mcolors + +from chart_studio import plotly +import plotly.graph_objs as go +import plotly.express as px +import plotly.colors +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def show(fig): + import io + import plotly.io as pio + from PIL import Image + buf = io.BytesIO() + pio.write_image(fig, buf) + img = Image.open(buf) + img.show() + + + + +# set the colormap and centre the colorbar +class MidpointNormalize(mcolors.Normalize): + """ + Normalise the colorbar so that diverging bars work there way either side from a prescribed midpoint value) + + e.g. im=ax1.imshow(array, norm=MidpointNormalize(midpoint=0.,vmin=-100, vmax=100)) + """ + def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): + self.midpoint = midpoint + mcolors.Normalize.__init__(self, vmin, vmax, clip) + + def __call__(self, value, clip=None): + # I'm ignoring masked values and all kinds of edge cases to make a + # simple example... + x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] + return np.ma.masked_array(np.interp(value, x, y), np.isnan(value)) + + + +def set_size(width, fraction=1): + """Set figure dimensions to avoid scaling in LaTeX. + + Parameters + ---------- + width: float + Document textwidth or columnwidth in pts + fraction: float, optional + Fraction of the width which you wish the figure to occupy + + Returns + ------- + fig_dim: tuple + Dimensions of figure in inches + """ + # Width of figure (in pts) + fig_width_pt = width * fraction + + # Convert from pt to inches + inches_per_pt = 1 / 72.27 + + # Golden ratio to set aesthetic figure height + # https://disq.us/p/2940ij3 + golden_ratio = (5**.5 - 1) / 2 + + # Figure width in inches + fig_width_in = fig_width_pt * inches_per_pt + # Figure height in inches + fig_height_in = fig_width_in * golden_ratio + + fig_dim = (fig_width_in, fig_height_in) + + return fig_dim + + + +def format_func(value, tick_number): + # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == -1: + # return r"$-\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + ##find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == -1: + return r"$-\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N == -2: + return r"$-\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + + +def check_case(q1,q2,q12,q3,b1,b2): + + # a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + print('det(H)=', np.linalg.det(H)) + + # check if g* is in G^*_R^2 + tmp = A.dot(b) + + ## compute inverse of H : + inv_H = np.linalg.inv(H) + + g_star = 2*inv_H.dot(tmp) + + print('g_star=', g_star) + + + return g_star + + +def determine_b(q1,q2,q12,q3,g_star): + ## + # Input: g_star + # Output : b such that g_star is minimizer, i.e A*b = (1/2)*H*g_star + # q1=1; + # q2=2; + # q12=1/2; + # q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + + + + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + rhs = (1/2)*H.dot(g_star) + print('rhs:', rhs) + b = np.linalg.lstsq(A, rhs)[0] + print('b',b) + b1=b[0] + b2=b[1] + + return b + ## --------------- + + +def get_minimizer(q1,q2,q3,b1,b2): + + # In the case if q12 == 0: + quotient = (q1*q2-q3**2) + g_star = np.array([(q1*q2*b1-q3*q2*b2)/quotient, (q1*q2*b2-q3*q1*b1)/quotient]) + print('g_star=', g_star) + return g_star + + +def energy(a1,a2,q1,q2,q12,q3,b1,b2): + + + a = np.array([a1,a2]) + b = np.array([b1,b2]) + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + + + tmp = H.dot(a) + + # print('H',H) + # print('A',A) + # print('b',b) + # print('a',a) + # print('tmp',tmp) + + tmp = (1/2)*a.dot(tmp) + # print('tmp',tmp) + + tmp2 = A.dot(b) + # print('tmp2',tmp2) + tmp2 = 2*a.dot(tmp2) + + # print('tmp2',tmp2) + energy = tmp - tmp2 + # print('energy',energy) + + + # energy_axial1.append(energy_1) + + return energy + + + +# def energy(a1,a2,q1,q2,q12,q3,b1,b2): +# +# +# b = np.array([b1,b2]) +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a',a) +# print('tmp',tmp) +# +# tmp = (1/2)*a.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a.dot(tmp2) +# +# print('tmp2',tmp2) +# energy = tmp - tmp2 +# print('energy',energy) +# +# +# # energy_axial1.append(energy_1) +# +# return energy +# + + +def draw_1ParameterLine(q1,q2,q12,q3): + + # q1=1; + # q2=2; + # q12=1/2; + # q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + + print('abar:',abar) + + b = np.linalg.lstsq(A, abar)[0] + print('b',b) + + b1=b[0] + b2=b[1] + + + # print('abar:',np.shape(abar)) + # print('np.transpose(abar):',np.shape(np.transpose(abar))) + sstar = (1/(q1+q2))*abar.dot(A.dot(b)) + # sstar = (1/(q1+q2))*abar.dot(tmp) + print('sstar', sstar) + abarperp= np.array([abar[1],-abar[0]]) + print('abarperp:',abarperp) + + N=500; + scale_domain = 5 + translate_startpoint = -1.8 + scale_domain = 4.65 + translate_startpoint = -1.85 + + # T = np.linspace(-sstar*(q12+2*q3)/(2*q2), sstar*(2*q2)/(q12+2*q3), num=N) + T = np.linspace(-sstar*(q12+2*q3)/(2*q2)*scale_domain + translate_startpoint, sstar*(2*q2)/(q12+2*q3)*scale_domain , num=N) + # T = np.linspace(-2,2, num=N) + # print('T:', T) + + print('T.min():', T.min()) + print('T.max():', T.max()) + + kappas = [] + alphas = [] + # G.append(float(s[0])) + + G_container = [] + abar_container = [] + + + abar_tmp = abar + + for t in T : + abar_current = sstar*abar+t*abarperp; + # print('abar_current', abar_current) + abar_current[abar_current < 1e-10] = 0 + # print('abar_current', abar_current) + # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] + # print('type of G', type(G)) + # print('G', G) + G_container.append(G) + abar_container.append(abar_current) + e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] + kappa = abar_current[0]+abar_current[1] + alpha = math.atan2(e[1], e[0]) + # print('angle current:', alpha) + kappas.append(kappa) + alphas.append(alpha) + + + alphas = np.array(alphas) + kappas = np.array(kappas) + + # print('G_container', G_container) + G = np.array(G_container) + abar = np.array(abar_container) + + # print('G', G) + # print('abar', abar) + # print('abar.shape',abar.shape) + line = ax.plot(abar[:,0],abar[:,1], linewidth=2, color='royalblue', linestyle='-', zorder=4) + + + return line + + + + +################################################################################################################ +################################################################################################################ +################################################################################################################ + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') + +# q1=1; +# q2=2; +# q12=1/2; +# q3=((4*q1*q2)**0.5-q12)/2; +# # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# abar = np.array([q12+2*q3, 2*q2]) +# abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar +# +# print('abar:',abar) +# +# b = np.linalg.lstsq(A, abar)[0] +# print('b',b) +# +# +# # print('abar:',np.shape(abar)) +# # print('np.transpose(abar):',np.shape(np.transpose(abar))) +# sstar = (1/(q1+q2))*abar.dot(A.dot(b)) +# # sstar = (1/(q1+q2))*abar.dot(tmp) +# print('sstar', sstar) +# abarperp= np.array([abar[1],-abar[0]]) +# print('abarperp:',abarperp) + + +# -------------------------- Input Parameters -------------------- +# +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 5.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 +# + + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = -0.75 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/2 +# # theta= 0.1 +# beta = 5.0 + + +#Figure3: +# mu1 = 1.0 +# rho1 = 1.0 +# alpha = 2.0 +# theta = 1.0/8 +# # theta= 0.1 +# beta = 2.0 + + +# alpha= -5 + + +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +# gamma = '0' +# # gamma = 'infinity' +# +# +# lambda1 = 0.0 + + +print('---- Input parameters: -----') +# print('mu1: ', mu1) +# print('rho1: ', rho1) +# # print('alpha: ', alpha) +# print('beta: ', beta) +# # print('theta: ', theta) +# print('gamma:', gamma) +# +# print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- +print('----------------------------') + +# ---------------------------------------------------------------- + + + + + + +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, alpha, theta ) +# b2 = prestrain_b2(rho1,beta, alpha, theta ) +# + + +case = 'a' +# case = 'b' +case = 'c' + + + +if case == 'a': + print('---- CASE (a) ----') + q1 = 1 + q2 = 2 + q12 = 0 + q3 = 1 + g_star = np.array([0,1]) + g_star = np.array([-1,1]) + # ToDO + b = determine_b(q1,q2,q12,q3, g_star) + b1 = b[0] + b2 = b[1] + + +if case == 'b': + print('---- CASE (b) ----') + q1 = 1 + q2 = 2 + q12 = 0 + q3 = 1 + g_star = np.array([1,1]) + # ToDO + b = determine_b(q1,q2,q12,q3, g_star) + b1 = b[0] + b2 = b[1] + + +if case == 'c': + print('---- CASE (c) ----') + ## ---- 1-ParameterFamilyCase: + q1=1; + q2=2; + q12=1/2; + q3=((4*q1*q2)**0.5-q12)/2; + # H=[2*q1,q12+2*q3;q12+2*q3,2*q2]; + H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) + A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) + abar = np.array([q12+2*q3, 2*q2]) + abar = (1.0/math.sqrt((q12+2*q3)**2+(2*q2)**2))*abar + print('abar:',abar) + b = np.linalg.lstsq(A, abar)[0] + print('b',b) + b1=b[0] + b2=b[1] + ## --------------- + + + + +print('q1 = ', q1) +print('q2 = ', q2) +print('q3 = ', q3) +print('q12 = ', q12) +print('b1 = ', b1) +print('b2 = ', b2) + +## --- CHECK CASE --- + + + + + +g_star = check_case(q1,q2,q12,q3,b1,b2) +print('g_star:',g_star) + +# TEST +print('special case g_star:') +get_minimizer(q1,q2,q3,b1,b2) + + + + +## ------------------------------------- + +num_Points = 400 +num_Points = 600 +num_Points = 200 +# num_Points = 100 +# num_Points = 20 + + +# Creating dataset +x = np.linspace(-5,5,num_Points) +y = np.linspace(-5,5,num_Points) + +x = np.linspace(-20,20,num_Points) +y = np.linspace(-20,20,num_Points) + + +x = np.linspace(-2,2,num_Points) +y = np.linspace(-2,2,num_Points) +# x = np.linspace(-10,10,num_Points) +# y = np.linspace(-10,10,num_Points) + +# x = np.linspace(-60,60,num_Points) +# y = np.linspace(-60,60,num_Points) +# +# +# x = np.linspace(-40,40,num_Points) +# y = np.linspace(-40,40,num_Points) + + +a1, a2 = np.meshgrid(x,y) + +# geyser = sns.load_dataset("geyser") +# print('type of geyser:', type(geyser)) +# print('geyser:',geyser) + +# ContourRange=20 +ContourRange=2 + +# x_in = np.linspace(-ContourRange,ContourRange,num_Points) +# y_in = np.linspace(-ContourRange,ContourRange,num_Points) +# a1_in, a2_in = np.meshgrid(x_in,y_in) + +print('a1:', a1) +print('a2:',a2 ) +print('a1.shape', a1.shape) + +#-- FILTER OUT VALUES for G+ : + +# tmp1 = a1[np.where(a1*a2 >= 0)] +# tmp2 = a2[np.where(a1*a2 >= 0)] +# +# np.take(a, np.where(a>100)[0], axis=0) +# tmp1 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = np.take(a1, np.where(a1*a2 >= 0)[0], axis=0) +# tmp2 = a2[np.where(a1*a2 >= 0)] + +tmp1 = a1[a1*a2 >= 0] +tmp2 = a2[a1*a2 >= 0] +tmp1 = tmp1.reshape(-1,5) +tmp2 = tmp2.reshape(-1,5) + + +# tmp1_pos = a1[np.where(a1*a2 >= 0) ] +# tmp2_pos = a2[np.where(a1*a2 >= 0) ] +# tmp1_pos = tmp1_pos[np.where(tmp1_pos >= 0)] +# tmp2_pos = tmp2_pos[np.where(tmp2_pos >= 0)] +# +# tmp1_neg = a1[a1*a2 >= 0 ] +# tmp2_neg = a2[a1*a2 >= 0 ] +# tmp1_neg = tmp1_neg[tmp1_neg < 0] +# tmp2_neg = tmp2_neg[tmp2_neg < 0] +# a1 = tmp1 +# a2 = tmp2 +# +# a1 = a1.reshape(-1,5) +# a2 = a2.reshape(-1,5) +# +# tmp1_pos = tmp1_pos.reshape(-1,5) +# tmp2_pos = tmp2_pos.reshape(-1,5) +# tmp1_neg = tmp1_neg.reshape(-1,5) +# tmp2_neg = tmp2_neg.reshape(-1,5) + + +# print('a1:', a1) +# print('a2:',a2 ) +# print('a1.shape', a1.shape) + + + + + +energyVec = np.vectorize(energy) + +# Z = energyVec(np.array([a1,a2]),q1,q2,q12,q3,b1,b2) +Z = energyVec(a1,a2,q1,q2,q12,q3,b1,b2) + +# Z_in = energyVec(a1_in,a2_in,q1,q2,q12,q3,b1,b2) + + + + +print('Z:', Z) +print('any', np.any(Z<0)) + + + + + + + +# negZ_a1 = a1[np.where(Z<0)] +# negZ_a2 = a2[np.where(Z<0)] +# negativeValues = Z[np.where(Z<0)] +# print('negativeValues:',negativeValues) +# +# print('negZ_a1',negZ_a1) +# print('negZ_a2',negZ_a2) +# +# +# negZ_a1 = negZ_a1.reshape(-1,5) +# negZ_a2 = negZ_a2.reshape(-1,5) +# negativeValues = negativeValues.reshape(-1,5) +# +# Z_pos = energyVec(tmp1_pos,tmp2_pos,q1,q2,q12,q3,b1,b2) +# Z_neg = energyVec(tmp1_neg,tmp2_neg,q1,q2,q12,q3,b1,b2) + + + + + +# print('Test energy:' , energy(np.array([1,1]),q1,q2,q12,q3,b1,b2)) + + + + +# print('Z_pos.shape', Z_pos.shape) + + + + + + + +## -- PLOT : +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + +label_size = 8 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +# plt.style.use('seaborn') +# plt.style.use('seaborn-whitegrid') +# sns.set() +# plt.style.use('seaborn-whitegrid') + +label_size = 9 +mpl.rcParams['xtick.labelsize'] = label_size +mpl.rcParams['ytick.labelsize'] = label_size + +width = 6.28 *0.5 +# width = 6.28 *0.33 +# width = 6.28 +height = width #/ 1.618 + +# width = 452.9579/2 +# size= set_size(width, fraction=0.5) +# print('set_size(width, fraction=0.5)', set_size(width, fraction=1)) +# print('size[0]',size[0]) + +f_size = 10 +# fig= plt.figure() +# fig, ax = plt.subplots() +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.5)) +ax = plt.axes(projection ='3d', adjustable='box') +# ax = plt.axes((0.17,0.21 ,0.75,0.75)) + +# ax = plt.axes((0.17,0.23 ,0.7,0.7)) +# ax = plt.axes((0.17,0.23 ,1.0,1.0)) +# ax=plt.axes() +# ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) + +# colorfunction=(B*kappa) +# print('colofunction',colorfunction) + +#translate Data +# Z = Z - (Z.max()-Z.min())/2 +# Z = Z - 50 +# Z = Z - 500 +# +# Z = Z.T + + +# Substract constant: +# c = (b1**2)*q1+b1*b2*q12+(b2**2)*q2 +# Z = Z-c +# +# print('Value of c:', c) + + + +print('Z.min()', Z.min()) +print('Z.max()', Z.max()) +norm=mcolors.Normalize(Z.min(),Z.max()) +# facecolors=cm.brg(norm) + + + +print('norm:', norm) +print('type of norm', type(norm)) +print('norm(0):', norm(0)) +print('norm(Z):', norm(Z)) + +# ax.plot(theta_rho, theta_values, 'royalblue', zorder=3, ) + +# ax.scatter(a1,a2, s=0.5) + +# ax.scatter(tmp1_pos,tmp2_pos, s=0.5) +# ax.scatter(tmp1_neg,tmp2_neg, s=0.5) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=100 ) +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, levels=20 ) + + +# sns.kdeplot(np.array([a1, a2, Z])) +# sns.kdeplot(tmp1_pos,tmp2_pos,Z_pos) + +# levels = [-5.0, -4, -3, 0.0, 1.5, 2.5, 3.5] +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, corner_mask=True,levels=levels) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot(norm(Z)), corner_mask=True) +# CS = ax.contour(a1, a2, Z, cm.brg(norm(Z)), levels=20) +# CS = ax.contour(a1, a2, Z, cmap=plt.cm.gnuplot, levels=20) +# CS = ax.contour(a1, a2, Z, colors='k', levels=14, linewidths=(0.5,)) +# CS = ax.contour(a1, a2, Z, colors='k', levels=18, linewidths=(0.5,)) + +# ax.contour(negZ_a1, negZ_a2, negativeValues, colors='k', linewidths=(0.5,)) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75) ,zorder=5) + + +step = (-1)*Z.min() +# step = 3.0 + +levels = np.arange(Z.min(),Z.max()/2,step) +# evels = np.arange(-4, 25, 4) +# levels = np.arange(-3, 23, 4) + +# levels = np.arange(Z.min(),Z.max()/12,step) +# levels = np.arange(Z.min(),Z.max(),step) +# levels = np.arange(0,Z.max()/2,200) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(0.75), levels=levels ,zorder=5) + +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.75), levels=levels ,zorder=5) +# CS = ax.contour(a1, a2, Z,5, colors='k', linewidths=(0.75) ,zorder=5, vmin=Z.min(), vmax=1) + +# CS = ax.contour(a1, a2, Z,5, colors='k', linewidths=(0.75) ,zorder=5, vmin=Z.min(), vmax=1) + +if case == 'b': + levels = np.arange(-4, 25, 4) + + +if case == 'a': + levels = np.arange(-1, 25, 5) # if g_star = [0 1] + levels = np.arange(0, 24, 4) # if g_star = [-1 1] +if case == 'c': + levels = np.arange(0, 25, 4) + +# CS = ax.contour(a1, a2, Z,levels, colors='k',linewidths=(0.75), extent=(-2, 2, -2, 2), zorder=5) + + +# CS = ax.contour(a1 , a2 , Z, colors='k', linewidths=(0.75), zorder=5) +# CS = ax.contour(a1_in, a2_in, Z_in, colors='k', linewidths=(1) , vmin= Z.min()+0.04, zorder=5) +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(1) , vmin= Z.min()+0.04, zorder=5) + + + +# df = pd.DataFrame(data=Z_in, columns=a1_in, index=a2_in) +# df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), +# columns=['a', 'b', 'c']) + +# sns.kdeplot(data=df2, x="waiting", y="duration") +# sns.kdeplot(data=df2) + +# CS = ax.contour(a1, a2, Z, colors='k', linewidths=(0.5,)) + +# CS = ax.contour(a1, a2, Z,10, cmap=plt.cm.gnuplot, extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k', extend='both', levels=50) +# CS = ax.contourf(a1, a2, Z,10, colors='k') +# +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, levels=10 ) +# # CS = ax.contour(tmp1_pos,tmp2_pos, Z_pos,10, cmap=plt.cm.gnuplot, corner_mask=True) +# +# CS = ax.contour(a1, a2, Z,10, colors = 'k') +# ax.clabel(CS, inline=True, fontsize=4) + +# ax.clabel(CS, inline=True, fontsize=4) + + +# 1- ParameterFAMILY CASE : +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ),(-12.5,-12.5),(-14,-14), (-15,-15), +# (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + + +if case == 'c': + manual_locations = [ + (1, 1), (0.5, 0.5),(1.5,1.5),(1.75,1.75),(-0.2,0.2), (-0.5,-0.5), + (-1,-1),(-1.25,-1.25), (-1.5,-1.5)] + # ax.clabel(CS, inline=True, fontsize=9, colors='black', manual=manual_locations) +else : + ax.clabel(CS, inline=True, fontsize=9, colors='black', zorder=5) + +# GAMMA = inf +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ), (-15,-15), +# (5, 5), (10, 10 ),(12.5,12.5), (15,15), (17,17)] + +# +# +# # GAMMA = 0 +# manual_locations = [ +# (1, 1), (-5, -5), (-10, -10 ), (-15,-15), (-15,7), +# (5, 5), (10, 10 ), (15,15), (17,17)] + + +# ax.clabel(CS, inline=True, fontsize=f_size, colors='black') +# ax.clabel(CS, inline=True, fontsize=9, colors='black', zorder=5) + +# cmap = cm.brg(norm(Z)) +# +# C_map = cm.inferno(norm(Z)) + +# ax.imshow(Z, cmap=C_map, extent=[-20, 20, -20, 20], origin='lower', alpha=0.5) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20], origin='lower', +# cmap='bwr', alpha=0.8) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', vmin=Z.min(), vmax=Z.max(), +# cmap='bwr', alpha=0.6) + +# ax.imshow(norm(Z), extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + + +cmap=mpl.cm.RdBu_r +cmap=mpl.cm.viridis_r +# cmap=mpl.cm.bwr +cmap=mpl.cm.coolwarm +# cmap=mpl.cm.gnuplot +cmap=mpl.cm.magma_r +# cmap=mpl.cm.inferno_r +# cmap=mpl.cm.plasma +# cmap=mpl.cm.plasma_r +# cmap=mpl.cm.cividis_r +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","violet","red"]) +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", ["blue","orange"]) + +# cmap = mpl.colors.LinearSegmentedColormap.from_list("", [(0,"red"), (.1,"violet"), (.5, "blue"), (1.0, "green")]) +# make a colormap that has land and ocean clearly delineated and of the +# same length (256 + 256) +# +# colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256)) +# colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256)) +# all_colors = np.vstack((colors_undersea, colors_land)) +# # cmap = mcolors.LinearSegmentedColormap.from_list( +# # 'terrain_map', all_colors) + + +# cmap = px.colors.sequential.agsunset +# cmap = plotly.colors.PLOTLY_SCALES["Viridis"] + + + + + +# cmap = cm.brg(Z) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=(Z.max()+Z.min())/2, vmax=Z.max()) +# divnorm=mcolors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=Z.max()) + +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0. ,vmax=10) +# divnorm=mcolors.TwoSlopeNorm(vmin=-10, vcenter=0., vmax=Z.max()) + +# divnorm=mcolors.LogNorm(vmin=Z.min(), vmax=Z.max()) #Test LogNorm + +# cmap = cm.brg(divnorm(Z)) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', norm = norm, +# cmap='coolwarm', alpha=0.6) + +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap='coolwarm', alpha=0.6) +# ax.imshow(Z, extent=[-20, 20, -20, 20],origin='lower', +# cmap=cmap, alpha=0.6) + +# divnorm=mcolors.TwoSlopeNorm(vmin=Z.min(), vcenter=0., vmax=Z.max()) +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', +# cmap=cmap, alpha=0.6) + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.9) + + + + +# plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = divnorm, +# cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', + # cmap=cmap, alpha=0.6) + + +# I = plt.imshow(Z, extent=[x.min(), x.max(), y.min(), y.max()],origin='lower', norm = mcolors.CenteredNorm(), +# cmap=cmap, alpha=0.6) + + + +# COLORBAR : +# cbar = plt.colorbar() +# cbar.ax.tick_params(labelsize=f_size) +# fig.colorbar(I) + + + +##----- ADD RECTANGLE TO COVER QUADRANT : +epsilon = 0.4 +epsilon = 0.2 +epsilon = 0.005 +epsilon = 0.01 +# ax.axvspan(0, x.max(), y.min(), 0, alpha=1, color='yellow', zorder=5)#yellow +# ax.fill_between([0, x.max()], y.min(), 0, alpha=0.3, color='yellow', zorder=5)#yellow +# ax.fill_between([x.min(), 0], 0, y.max(), alpha=0.3, color='yellow', zorder=5)#yellow + +fillcolor = 'white' +# ax.fill_between([0+epsilon, x.max()], y.min(), 0-epsilon, alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min(), 0-epsilon], 0+epsilon, y.max(), alpha=0.7, color=fillcolor, zorder=4)#yellow +# ax.fill_between([0+epsilon, x.max()-epsilon], y.min()+epsilon, 0-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow +# ax.fill_between([x.min()+epsilon, 0-epsilon], 0+epsilon, y.max()-epsilon, alpha=1.0, color=fillcolor, zorder=4)#yellow + +ax.plot_surface(a1,a2, Z, cmap=cm.coolwarm, + linewidth=0, antialiased=False) + + + +# ax.plot(theta_rho, energy_axial1, 'royalblue', zorder=3, label=r"axialMin1") +# ax.plot(theta_rho, energy_axial2, 'forestgreen', zorder=3, label=r"axialMin2") +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) + + + +if case == 'c': + print('draw Line') + # line = draw_1ParameterLine(q1,q2,q12,q3) +else: + # PLOT MINIMIZER g*: + ax.scatter(g_star[0],g_star[1], s=20, zorder=5) + ax.text(g_star[0]+0.1,g_star[1]-0.1, r"$g_*$", color='royalblue', size=15, zorder = 5) + +# lg = ax.legend(bbox_to_anchor=(0.0, 0.75), loc='upper left') + +if case == 'c': + # draw minimizers + print('np.where(Z == Z.min())',np.where(np.round(Z,3) == np.round(Z.min(),3))) + # tmp_x = a1[np.where(np.round(Z,6) == np.round(Z.min(),6))] + # tmp_y = a2[np.where(np.round(Z,6) == np.round(Z.min(),6))] + # # ax.scatter(tmp_x,tmp_y,color='red', zorder=5, s=1) + # # ax.plot(tmp_x,tmp_y,color='red', zorder=5) + # ax.plot(tmp_x,tmp_y,color='royalblue', zorder=5) + + +### PLot x and y- Axes +ax.plot(ax.get_xlim(),[0,0],'k--', linewidth=0.5, zorder=4) +ax.plot([0,0],ax.get_ylim(), 'k--', linewidth=0.5, zorder=4) + + + + + + +ax.set_xlabel(r"$a_1$", fontsize=f_size ,labelpad=0) +ax.set_ylabel(r"$a_2$", fontsize=f_size ,labelpad=0) +# ax.set_ylabel(r"energy") +ax.tick_params(axis='both', which='major', labelsize=f_size) +ax.tick_params(axis='both', which='minor', labelsize=f_size) + + + +# ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax.set_yticklabels(labels) + + +# plt.subplots_adjust(left = 0.25 ) + + +# ax.legend(loc='upper right') + +# fig.subplots_adjust(left=.18, bottom=.12, right=.90, top=.97) + +# fig.set_size_inches(width, height) +# fig.set_size_inches(set_size(width, fraction=0.33)) +Outputname = 'Energy_ContourG+_case'+ str(case) + '.pdf' +# fig.savefig(Outputname) + +plt.show() + + +# +# +# +# # Curve parametrised by \theta_rho = alpha in parameter space +# N=100; +# theta_rho = np.linspace(1, 3, num=N) +# print('theta_rho:', theta_rho) +# +# +# theta_values = [] +# +# +# for t in theta_rho: +# +# s = (1.0/10.0)*t+0.1 +# theta_values.append(s) +# +# +# +# +# +# theta_rho = np.array(theta_rho) +# theta_values = np.array(theta_values) +# +# betas_ = 2.0 +# + +# alphas, betas, thetas = np.meshgrid(theta_rho, betas_, theta_values, indexing='ij') +# +# +# harmonicMeanVec = np.vectorize(harmonicMean) +# arithmeticMeanVec = np.vectorize(arithmeticMean) +# prestrain_b1Vec = np.vectorize(prestrain_b1) +# prestrain_b2Vec = np.vectorize(prestrain_b2) +# +# GetMuGammaVec = np.vectorize(GetMuGamma) +# muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# +# q1_vec = harmonicMeanVec(mu1, betas, thetas) +# q2_vec = arithmeticMeanVec(mu1, betas, thetas) +# +# b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) + +# special case: q12 == 0!! .. braucht eigentlich nur b1 & b2 ... + +# print('type b1_values:', type(b1_values)) + + + +# print('size(q1)',q1.shape) +# +# +# energy_axial1 = [] +# energy_axial2 = [] +# +# # for b1 in b1_values: +# for i in range(len(theta_rho)): +# print('index i:', i) +# +# print('theta_rho[i]',theta_rho[i]) +# print('theta_values[i]',theta_values[i]) +# +# q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta_values[i]) +# q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta_values[i]) +# q12 = 0.0 +# q3 = GetMuGamma(beta, theta_values[i],gamma,mu1,rho1,InputFilePath ,OutputFilePath ) +# b1 = prestrain_b1(rho1,beta, theta_rho[i],theta_values[i] ) +# b2 = prestrain_b2(rho1,beta, theta_rho[i],theta_values[i] ) +# +# +# # q2_vec = arithmeticMean(mu1, betas, thetas) +# # +# # b1_vec = prestrain_b1Vec(rho1, betas, alphas, thetas) +# # b2_vec = prestrain_b2Vec(rho1, betas, alphas, thetas) +# print('q1[i]',q1) +# print('q2[i]',q2) +# print('q3[i]',q3) +# print('b1[i]',b1) +# print('b2[i]',b2) +# # print('q1[i]',q1[0][i]) +# # print('q2[i]',q2[i]) +# # print('b1[i]',b1[i]) +# # print('b2[i]',b2[i]) +# #compute axial energy #1 ... +# +# a_axial1 = np.array([b1,0]) +# a_axial2 = np.array([0,b2]) +# b = np.array([b1,b2]) +# +# H = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# A = np.array([[q1,1/2*q12], [1/2*q12,q2] ]) +# +# +# tmp = H.dot(a_axial1) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial1',a_axial1) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial1.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial1.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_1 = tmp - tmp2 +# print('energy_1',energy_1) +# +# +# energy_axial1.append(energy_1) +# +# +# tmp = H.dot(a_axial2) +# +# print('H',H) +# print('A',A) +# print('b',b) +# print('a_axial2',a_axial2) +# print('tmp',tmp) +# +# tmp = (1/2)*a_axial2.dot(tmp) +# print('tmp',tmp) +# +# tmp2 = A.dot(b) +# print('tmp2',tmp2) +# tmp2 = 2*a_axial2.dot(tmp2) +# +# print('tmp2',tmp2) +# energy_2 = tmp - tmp2 +# print('energy_2',energy_2) +# +# +# energy_axial2.append(energy_2) +# +# +# +# +# +# print('theta_values', theta_values) +# +# +# + + +# +# +# +# +# kappas = [] +# alphas = [] +# # G.append(float(s[0])) +# +# +# +# +# for t in T : +# +# abar_current = sstar*abar+t*abarperp; +# # print('abar_current', abar_current) +# abar_current[abar_current < 1e-10] = 0 +# # print('abar_current', abar_current) +# +# # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) +# G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] +# +# e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] +# kappa = abar_current[0]+abar_current[1] +# alpha = math.atan2(e[1], e[0]) +# +# print('angle current:', alpha) +# +# kappas.append(kappa) +# alphas.append(alpha) +# +# +# +# alphas = np.array(alphas) +# kappas = np.array(kappas) +# +# +# print('kappas:',kappas) +# print('alphas:',alphas) +# print('min alpha:', min(alphas)) +# print('min kappa:', min(kappas)) +# +# mpl.rcParams['text.usetex'] = True +# mpl.rcParams["font.family"] = "serif" +# mpl.rcParams["font.size"] = "9" +# width = 6.28 *0.5 +# height = width / 1.618 +# fig = plt.figure() +# # ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# # ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# # ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# # ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax.xaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.xaxis.set_minor_locator(plt.MultipleLocator(np.pi / 4)) +# ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax.grid(True,which='major',axis='both',alpha=0.3) +# +# +# +# +# ax.plot(alphas, kappas, 'royalblue', zorder=3, ) +# ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) diff --git a/src/PhaseDiagram (copy).py b/src/PhaseDiagram (copy).py deleted file mode 100644 index 3991bdb639c3cf93dd71334a0000175b0a621c67..0000000000000000000000000000000000000000 --- a/src/PhaseDiagram (copy).py +++ /dev/null @@ -1,346 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import sympy as sym -import math -import os -import subprocess -import fileinput -import re -import matlab.engine -import sys -from ClassifyMin import * -from HelperFunctions import * -# from CellScript import * -from mpl_toolkits.mplot3d import Axes3D -import matplotlib.cm as cm -from vtk.util import numpy_support -from pyevtk.hl import gridToVTK - -import time -# print(sys.executable) - -# -------------------------------------------------------------------- -# START : -# INPUT (Parameters): alpha, beta, theta, gamma, mu1, rho1 -# -# -Option 1 : (Case lambda = 0 => q12 = 0) -# compute q1,q2,b1,b2 from Formula -# Option 1.1 : -# set mu_gamma = 'q1' or 'q2' (extreme regimes: gamma \in {0,\infty}) -# Option 1.2 : -# compute mu_gamma with 'Compute_MuGamma' (2D problem much faster then Cell-Problem) -# -Option 2 : -# compute Q_hom & B_eff by running 'Cell-Problem' -# -# -> CLASSIFY ... -# -# OUTPUT: Minimizer G, angle , type, curvature -# ----------------------------------------------------------------------- -# -# -# def GetMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath = os.path.dirname(os.getcwd()) +"/inputs/computeMuGamma.parset", -# OutputFilePath = os.path.dirname(os.getcwd()) + "/outputs/outputMuGamma.txt" ): -# # ------------------------------------ get mu_gamma ------------------------------ -# # ---Scenario 1.1: extreme regimes -# if gamma == '0': -# print('extreme regime: gamma = 0') -# mu_gamma = (1.0/6.0)*arithmeticMean(mu1, beta, theta) # = q2 -# print("mu_gamma:", mu_gamma) -# elif gamma == 'infinity': -# print('extreme regime: gamma = infinity') -# mu_gamma = (1.0/6.0)*harmonicMean(mu1, beta, theta) # = q1 -# print("mu_gamma:", mu_gamma) -# else: -# # --- Scenario 1.2: compute mu_gamma with 'Compute_MuGamma' (much faster than running full Cell-Problem) -# # print("Run computeMuGamma for Gamma = ", gamma) -# with open(InputFilePath, 'r') as file: -# filedata = file.read() -# filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) -# # filedata = re.sub('(?m)^alpha=.*','alpha='+str(alpha),filedata) -# filedata = re.sub('(?m)^beta=.*','beta='+str(beta),filedata) -# filedata = re.sub('(?m)^theta=.*','theta='+str(theta),filedata) -# filedata = re.sub('(?m)^mu1=.*','mu1='+str(mu1),filedata) -# filedata = re.sub('(?m)^rho1=.*','rho1='+str(rho1),filedata) -# f = open(InputFilePath,'w') -# f.write(filedata) -# f.close() -# # --- Run Cell-Problem -# -# # Check Time -# # t = time.time() -# # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Cell-Problem_muGama -> faster -# # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], -# # capture_output=True, text=True) -# # --- Run Compute_muGamma (2D Problem much much faster) -# -# subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], -# capture_output=True, text=True) -# # print('elapsed time:', time.time() - t) -# -# #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST -# with open(OutputFilePath, 'r') as file: -# output = file.read() -# tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... -# s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) -# mu_gamma = float(s[0]) -# # print("mu_gamma:", mu_gammaValue) -# # -------------------------------------------------------------------------------------- -# return mu_gamma -# - - - -# ----------- SETUP PATHS -# InputFile = "/inputs/cellsolver.parset" -# OutputFile = "/outputs/output.txt" -InputFile = "/inputs/computeMuGamma.parset" -OutputFile = "/outputs/outputMuGamma.txt" -# --------- Run from src folder: -path_parent = os.path.dirname(os.getcwd()) -os.chdir(path_parent) -path = os.getcwd() -print(path) -InputFilePath = os.getcwd()+InputFile -OutputFilePath = os.getcwd()+OutputFile -print("InputFilepath: ", InputFilePath) -print("OutputFilepath: ", OutputFilePath) -print("Path: ", path) - - -# -------------------------- Input Parameters -------------------- -mu1 = 10.0 # TODO : here must be the same values as in the Parset for computeMuGamma -rho1 = 1.0 -alpha = 2.0 -beta = 2.0 -# beta = 10.0 -theta = 1.0/4.0 -#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value -gamma = '0' -# gamma = 'infinity' -# gamma = 0.5 -# gamma = 0.25 -# gamma = 1.0 - -# gamma = 5.0 - -#added -# lambda1 = 10.0 -lambda1 = 0.0 - - - - - -print('---- Input parameters: -----') -print('mu1: ', mu1) -print('rho1: ', rho1) -print('alpha: ', alpha) -print('beta: ', beta) -print('theta: ', theta) -print('gamma:', gamma) - -print('lambda1: ', lambda1) -print('----------------------------') -# ---------------------------------------------------------------- - - -# gamma_min = 0.5 -# gamma_max = 1.0 -# -# # gamma_min = 1 -# # gamma_max = 1 -# Gamma_Values = np.linspace(gamma_min, gamma_max, num=3) -# # # -# # # Gamma_Values = np.linspace(gamma_min, gamma_max, num=13) # TODO variable Input Parameters...alpha,beta... -# print('(Input) Gamma_Values:', Gamma_Values) -# # # -# for gamma in Gamma_Values: - - - # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1,InputFilePath) - # # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1) - # print('Test MuGamma:', muGamma) - - # ------- Options -------- - # print_Cases = True - # print_Output = True - - #TODO -# generalCase = True #Read Output from Cell-Problem instead of using Lemma1.4 (special case) -generalCase = False - -# make_3D_plot = True -# make_3D_PhaseDiagram = True -make_2D_plot = False -# make_2D_PhaseDiagram = False -make_3D_plot = False -make_3D_PhaseDiagram = False -# make_2D_plot = True -make_2D_PhaseDiagram = True - - -# --- Define effective quantities: q1, q2 , q3 = mu_gamma, q12 --- -# q1 = harmonicMean(mu1, beta, theta) -# q2 = arithmeticMean(mu1, beta, theta) -# --- Set q12 -# q12 = 0.0 # (analytical example) # TEST / TODO read from Cell-Output - - - - - -# b1 = prestrain_b1(rho1, beta, alpha, theta) -# b2 = prestrain_b2(rho1, beta, alpha, theta) -# -# print('---- Input parameters: -----') -# print('mu1: ', mu1) -# print('rho1: ', rho1) -# print('alpha: ', alpha) -# print('beta: ', beta) -# print('theta: ', theta) -# print("q1: ", q1) -# print("q2: ", q2) -# print("mu_gamma: ", mu_gamma) -# print("q12: ", q12) -# print("b1: ", b1) -# print("b2: ", b2) -# print('----------------------------') -# print("machine epsilon", sys.float_info.epsilon) - -# G, angle, type, kappa = classifyMin(q1, q2, mu_gamma, q12, b1, b2, print_Cases, print_Output) -# Test = f(1,2 ,q1,q2,mu_gamma,q12,b1,b2) -# print("Test", Test) - -# ---------------------- MAKE PLOT / Write to VTK------------------------------------------------------------------------------ - -# SamplePoints_3D = 10 # Number of sample points in each direction -# SamplePoints_2D = 10 # Number of sample points in each direction -SamplePoints_3D = 300 # Number of sample points in each direction -SamplePoints_2D = 100 # Number of sample points in each direction - - - -if make_3D_PhaseDiagram: - alphas_ = np.linspace(-20, 20, SamplePoints_3D) - betas_ = np.linspace(0.01,40.01,SamplePoints_3D) - thetas_ = np.linspace(0.01,0.99,SamplePoints_3D) - # print('type of alphas', type(alphas_)) - # print('Test:', type(np.array([mu_gamma])) ) - alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') - classifyMin_anaVec = np.vectorize(classifyMin_ana) - - # Get MuGamma values ... - GetMuGammaVec = np.vectorize(GetMuGamma) - muGammas = GetMuGammaVec(betas, thetas, gamma, mu1, rho1) - # Classify Minimizers.... - G, angles, Types, curvature = classifyMin_anaVec(alphas, betas, thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! - # print('size of G:', G.shape) - # print('G:', G) - # Out = classifyMin_anaVec(alphas,betas,thetas) - # T = Out[2] - # --- Write to VTK - - GammaString = str(gamma) - VTKOutputName = "outputs/PhaseDiagram3D" + "Gamma" + GammaString - gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) - print('Written to VTK-File:', VTKOutputName ) - -if make_2D_PhaseDiagram: - # alphas_ = np.linspace(-20, 20, SamplePoints_2D) - # thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) - # alphas_ = np.linspace(-5, 15, SamplePoints_2D) - # thetas_ = np.linspace(0.05,0.25,SamplePoints_2D) - - - # good range: - # alphas_ = np.linspace(9, 10, SamplePoints_2D) - # thetas_ = np.linspace(0.075,0.14,SamplePoints_2D) - - alphas_ = np.linspace(8, 10, SamplePoints_2D) - thetas_ = np.linspace(0.05,0.16,SamplePoints_2D) - - # alphas_ = np.linspace(8, 12, SamplePoints_2D) - # thetas_ = np.linspace(0.05,0.2,SamplePoints_2D) - # betas_ = np.linspace(0.01,40.01,1) - #fix to one value: - betas_ = 2.0; - alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') - - - if generalCase: - classifyMin_matVec = np.vectorize(classifyMin_mat) - GetCellOutputVec = np.vectorize(GetCellOutput, otypes=[np.ndarray, np.ndarray]) - Q, B = GetCellOutputVec(alphas,betas,thetas,gamma,mu1,rho1,lambda1, InputFilePath ,OutputFilePath ) - - - # print('type of Q:', type(Q)) - # print('Q:', Q) - G, angles, Types, curvature = classifyMin_matVec(Q,B) - - else: - classifyMin_anaVec = np.vectorize(classifyMin_ana) - GetMuGammaVec = np.vectorize(GetMuGamma) - muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) - G, angles, Types, curvature = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! - # print('size of G:', G.shape) - # print('G:', G) - # print('Types:', Types) - # Out = classifyMin_anaVec(alphas,betas,thetas) - # T = Out[2] - # --- Write to VTK - # VTKOutputName = + path + "./PhaseDiagram2DNEW" - - GammaString = str(gamma) - VTKOutputName = "outputs/PhaseDiagram2D" + "Gamma_" + GammaString - gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) - print('Written to VTK-File:', VTKOutputName ) - - -# --- Make 3D Scatter plot -if(make_3D_plot or make_2D_plot): - fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - colors = cm.plasma(Types) - # if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=Types.flat) - # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=Types.flat) - if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=angles.flat) - if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=angles.flat) - # cbar=plt.colorbar(pnt3d) - # cbar.set_label("Values (units)") - plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') - plt.axhline(y = 0.083333333, color = 'b', linestyle = ':', label='$q_1$') - - ax.set_xlabel('alpha') - ax.set_ylabel('beta') - if make_3D_plot: ax.set_zlabel('theta') - plt.show() - # plt.savefig('common_labels.png', dpi=300) - # print('T:', T) - # print('Type 1 occured here:', np.where(T == 1)) - # print('Type 2 occured here:', np.where(T == 2)) - - - # print(alphas_) - # print(betas_) - - - - - -# ALTERNATIVE -# colors = ("red", "green", "blue") -# groups = ("Type 1", "Type2", "Type3") -# -# # Create plot -# fig = plt.figure() -# ax = fig.add_subplot(1, 1, 1) -# -# for data, color, group in zip(Types, colors, groups): -# # x, y = data -# ax.scatter(alphas, thetas, alpha=0.8, c=color, edgecolors='none', label=group) -# -# plt.title('Matplot scatter plot') -# plt.legend(loc=2) -# plt.show() diff --git a/src/PhaseDiagram.py b/src/PhaseDiagram.py index f82a4cb64d992f9564d046e79204aa6dbda55014..85cf67d3c060ff5d83f703ad23434709b60b4517 100644 --- a/src/PhaseDiagram.py +++ b/src/PhaseDiagram.py @@ -17,6 +17,16 @@ from vtk.util import numpy_support from pyevtk.hl import gridToVTK import time + +from chart_studio import plotly +import plotly.graph_objs as go + +import mayavi.mlab as mlab +from mayavi.api import OffScreenEngine + +import scipy.signal +# mlab.options.offscreen = True + # print(sys.executable) # -------------------------------------------------------------------- @@ -119,7 +129,7 @@ beta = 2.0 theta = 1.0/4.0 #set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value gamma = '0' -# gamma = 'infinity' +gamma = 'infinity' # gamma = 0.5 # gamma = 0.25 # gamma = 1.0 @@ -130,7 +140,8 @@ gamma = '0' # lambda1 = 10.0 lambda1 = 0.0 - +#Test: +# rho1 = -1.0 @@ -159,8 +170,8 @@ print('----------------------------') print('type of gamma:', type(gamma)) # # # -Gamma_Values = ['0', 'infinity'] -# Gamma_Values = ['infinity'] +# Gamma_Values = ['0', 'infinity'] +Gamma_Values = ['infinity'] # Gamma_Values = ['0'] print('(Input) Gamma_Values:', Gamma_Values) @@ -180,14 +191,14 @@ for gamma in Gamma_Values: # generalCase = True #Read Output from Cell-Problem instead of using Lemma1.4 (special case) generalCase = False - # make_3D_plot = True - # make_3D_PhaseDiagram = True + make_3D_plot = True + make_3D_PhaseDiagram = True make_2D_plot = False make_2D_PhaseDiagram = False - make_3D_plot = False - make_3D_PhaseDiagram = False + # make_3D_plot = False + # make_3D_PhaseDiagram = False # make_2D_plot = True - make_2D_PhaseDiagram = True + # make_2D_PhaseDiagram = True # # --- Define effective quantities: q1, q2 , q3 = mu_gamma, q12 --- @@ -227,13 +238,15 @@ for gamma in Gamma_Values: # SamplePoints_3D = 10 # Number of sample points in each direction # SamplePoints_2D = 10 # Number of sample points in each direction SamplePoints_3D = 300 # Number of sample points in each direction - # SamplePoints_3D = 150 # Number of sample points in each direction + SamplePoints_3D = 150 # Number of sample points in each direction SamplePoints_3D = 100 # Number of sample points in each direction + # SamplePoints_3D = 50 # Number of sample points in each direction # SamplePoints_3D = 200 # Number of sample points in each direction # SamplePoints_3D = 400 # Number of sample points in each direction # SamplePoints_2D = 7500 # Number of sample points in each direction SamplePoints_2D = 4000 # 4000 # Number of sample points in each direction - SamplePoints_2D = 400 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 400 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 1000 # 4000 # Number of sample points in each direction if make_3D_PhaseDiagram: alphas_ = np.linspace(-20, 20, SamplePoints_3D) @@ -314,9 +327,9 @@ for gamma in Gamma_Values: #intermediate Values - alphas_ = np.linspace(-2, 1, SamplePoints_2D) - thetas_ = np.linspace(0.4,0.6,SamplePoints_2D) - betas_ = 10.0; + # alphas_ = np.linspace(-2, 1, SamplePoints_2D) + # thetas_ = np.linspace(0.4,0.6,SamplePoints_2D) + # betas_ = 10.0; # TEST # alphas_ = np.linspace(-8, 8, SamplePoints_2D) @@ -363,18 +376,73 @@ for gamma in Gamma_Values: ax = fig.add_subplot(111, projection='3d') colors = cm.plasma(Types) # if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=Types.flat) - # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=Types.flat) + if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=Types.flat) if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=angles.flat) - if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=angles.flat) + # cbar=plt.colorbar(pnt3d) # cbar.set_label("Values (units)") - plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') - plt.axhline(y = 0.083333333, color = 'b', linestyle = ':', label='$q_1$') + # plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 0.083333333, color = 'b', linestyle = ':', label='$q_1$') + + # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=angles.flat) + # if make_3D_plot: fig = go.Figure(data=[go.Surface(z=thetas, x=alphas, y=betas, color=angles.flat)]) + #### PLOTLY: + # print('angles.flatten()',angles.flatten()) + # fig = go.Figure(data=go.Isosurface( + # x=alphas.flatten(), + # y=betas.flatten(), + # z=thetas.flatten(), + # value=angles.flatten(), + # isomin=0, + # isomax=1.565, + # opacity=1.0, + # colorscale='agsunset', + # flatshading = True + # # caps=dict(x_show=False, y_show=False) + # )) + # fig.show() + + # ----TEST SAVITZKY_GOLAY FILTER + # zhat = scipy.signal.savgol_filter(angles.flatten(), 5, 4) # window size 51, polynomial order 3 + # + # fig = go.Figure(data=go.Volume( + # x=alphas.flatten(), + # y=betas.flatten(), + # z=thetas.flatten(), + # value=zhat, + # isomin=0.0, + # isomax=1.56, + # opacity=0.1, # needs to be small to see through all surfaces + # surface_count=17, # needs to be a large number for good volume rendering + # colorscale='RdBu' + # )) + # fig.show() + + + ## -------------------------------- + # alphas = np.array(alphas) + # print('alphas.shape:',np.shape(alphas)) + # #### ------- MAYAVI: + # # s = angles.flatten() + # s = angles + # src = mlab.pipeline.scalar_field(s) + # mlab.pipeline.iso_surface(src, contours=[s.min()+0.1*s.ptp(), ], opacity=0.3) + # mlab.pipeline.iso_surface(src, contours=[s.max()-0.1*s.ptp(), ],) + # # mlab.outline() + # # mlab.mesh(alphas,betas,thetas) + # mlab.colorbar( orientation='vertical', nb_labels=5) + # # mlab.orientation_axes() + # mlab.show() + ### --------------- + + + + ax.set_xlabel('alpha') ax.set_ylabel('beta') if make_3D_plot: ax.set_zlabel('theta') - plt.show() + # plt.show() # plt.savefig('common_labels.png', dpi=300) # print('T:', T) # print('Type 1 occured here:', np.where(T == 1)) diff --git a/src/PhaseDiagram_ContourSubPlots.py b/src/PhaseDiagram_ContourSubPlots.py index 59a1a421f3788f05ee57bbd32e168c58866e4d3b..125cd43a7d915f96a60944bdfb852a3b06a02210 100644 --- a/src/PhaseDiagram_ContourSubPlots.py +++ b/src/PhaseDiagram_ContourSubPlots.py @@ -240,8 +240,8 @@ for gamma in Gamma_Values: # SamplePoints_2D = 400 # 4000 # Number of sample points in each direction # SamplePoints_2D = 500 # 4000 # Number of sample points in each direction # SamplePoints_2D = 100 # 4000 # Number of sample points in each direction - SamplePoints_2D = 2000 # 4000 # Number of sample points in each direction - # SamplePoints_2D = 1000 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 2000 # 4000 # Number of sample points in each direction + SamplePoints_2D = 1000 # 4000 # Number of sample points in each direction if make_3D_PhaseDiagram: alphas_ = np.linspace(-20, 20, SamplePoints_3D) @@ -382,8 +382,8 @@ if(make_3D_plot or make_2D_plot): width = 6.28 - height = width / 1.618 - # height = width / 2.5 + # height = width / 1.618 + height = width / 2.5 # fig, ax = plt.subplots() fig,ax = plt.subplots(nrows=1,ncols=2,figsize=(width,height), sharey=True) # ax = plt.axes((0.15,0.21 ,0.8,0.75)) @@ -405,6 +405,8 @@ if(make_3D_plot or make_2D_plot): # ax.clabel(CS, inline=True, fontsize=7.5) # # ax.set_title('Simplest default with labels') + # matplotlib.rcParams['contour.linestyles'] = 'dashed' + CS_0 = ax[0].contourf(alphas, thetas, angles_0, 10, cmap=plt.cm.coolwarm) # CS = ax.contourf(alphas, thetas, angles, 10, cmap='RdBu') @@ -430,9 +432,12 @@ if(make_3D_plot or make_2D_plot): CS_12 = ax[1].contour(CS_1, levels=CS_1.levels[::2], colors='black',inline=True, linewidths=(0.5,)) # ax.clabel(CS2, inline=True, fontsize=9, colors='black') # ax.clabel(CS2, inline=True, inline_spacing=3, rightside_up=True, colors='k', fontsize=8) + # manual_locations = [ + # (-0.5, 0.3), (-0.7, 0.4), (-0.8, 0.5), (-0.9, 0.6), (-1,0.7)] manual_locations = [ - (-0.5, 0.3), (-0.7, 0.4), (-0.8, 0.5), (-0.9, 0.6), (-1,0.7)] - ax[1].clabel(CS_12, inline=True, fontsize=10, colors='black', manual=manual_locations) + (-0.5, 0.15), (-0.7, 0.3), (-0.8, 0.45), (-0.9, 0.6), (-1,0.75)] + # ax[1].clabel(CS_12, inline=True, fontsize=10, colors='black', manual=manual_locations) + ax[1].clabel(CS_12, inline=True, fontsize=8, colors='black', manual=manual_locations) # ax[1].clabel(CS_12, inline=True, fontsize=8, colors='black') @@ -456,7 +461,8 @@ if(make_3D_plot or make_2D_plot): # cbar = fig.colorbar(CS_1, ax=ax[:], shrink=0.8, location='right', ticks=[0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) cbar.ax.set_yticklabels(['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$']) - cbar.ax.set_title(r'angle $\alpha$') + # cbar.ax.set_title(r'angle $\alpha$') + cbar.ax.set_title(r'$\alpha$') # cbar=plt.colorbar(pnt3d) # cbar.set_label("Values (units)") # plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') @@ -485,7 +491,7 @@ if(make_3D_plot or make_2D_plot): # plt.subplots_adjust(bottom=0.2) # plt.subplots_adjust(wspace=0.22, hspace=0.1) plt.subplots_adjust(hspace=0.15, wspace=0.1) - + plt.subplots_adjust(bottom=0.2) # fig.subplots_adjust(right=0.75) diff --git a/src/PhaseDiagram_CurvContourSubPlots.py b/src/PhaseDiagram_CurvContourSubPlots.py new file mode 100644 index 0000000000000000000000000000000000000000..4846876127a52ffcf88a817fad62921a39122e1f --- /dev/null +++ b/src/PhaseDiagram_CurvContourSubPlots.py @@ -0,0 +1,510 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator + +from mpl_toolkits.axes_grid1.inset_locator import inset_axes + +import time +# print(sys.executable) + +# -------------------------------------------------------------------- +# START : +# INPUT (Parameters): alpha, beta, theta, gamma, mu1, rho1 +# +# -Option 1 : (Case lambda = 0 => q12 = 0) +# compute q1,q2,b1,b2 from Formula +# Option 1.1 : +# set mu_gamma = 'q1' or 'q2' (extreme regimes: gamma \in {0,\infty}) +# Option 1.2 : +# compute mu_gamma with 'Compute_MuGamma' (2D problem much faster then Cell-Problem) +# -Option 2 : +# compute Q_hom & B_eff by running 'Cell-Problem' +# +# -> CLASSIFY ... +# +# OUTPUT: Minimizer G, angle , type, curvature +# ----------------------------------------------------------------------- +# +# +# def GetMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath = os.path.dirname(os.getcwd()) +"/inputs/computeMuGamma.parset", +# OutputFilePath = os.path.dirname(os.getcwd()) + "/outputs/outputMuGamma.txt" ): +# # ------------------------------------ get mu_gamma ------------------------------ +# # ---Scenario 1.1: extreme regimes +# if gamma == '0': +# print('extreme regime: gamma = 0') +# mu_gamma = (1.0/6.0)*arithmeticMean(mu1, beta, theta) # = q2 +# print("mu_gamma:", mu_gamma) +# elif gamma == 'infinity': +# print('extreme regime: gamma = infinity') +# mu_gamma = (1.0/6.0)*harmonicMean(mu1, beta, theta) # = q1 +# print("mu_gamma:", mu_gamma) +# else: +# # --- Scenario 1.2: compute mu_gamma with 'Compute_MuGamma' (much faster than running full Cell-Problem) +# # print("Run computeMuGamma for Gamma = ", gamma) +# with open(InputFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) +# # filedata = re.sub('(?m)^alpha=.*','alpha='+str(alpha),filedata) +# filedata = re.sub('(?m)^beta=.*','beta='+str(beta),filedata) +# filedata = re.sub('(?m)^theta=.*','theta='+str(theta),filedata) +# filedata = re.sub('(?m)^mu1=.*','mu1='+str(mu1),filedata) +# filedata = re.sub('(?m)^rho1=.*','rho1='+str(rho1),filedata) +# f = open(InputFilePath,'w') +# f.write(filedata) +# f.close() +# # --- Run Cell-Problem +# +# # Check Time +# # t = time.time() +# # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], +# # capture_output=True, text=True) +# # --- Run Cell-Problem_muGama -> faster +# # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], +# # capture_output=True, text=True) +# # --- Run Compute_muGamma (2D Problem much much faster) +# +# subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], +# capture_output=True, text=True) +# # print('elapsed time:', time.time() - t) +# +# #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST +# with open(OutputFilePath, 'r') as file: +# output = file.read() +# tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... +# s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) +# mu_gamma = float(s[0]) +# # print("mu_gamma:", mu_gammaValue) +# # -------------------------------------------------------------------------------------- +# return mu_gamma +# + + + +# ----------- SETUP PATHS +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + + +# -------------------------- Input Parameters -------------------- +# mu1 = 10.0 # TODO : here must be the same values as in the Parset for computeMuGamma +mu1 = 1.0 +rho1 = 1.0 +alpha = 2.0 +beta = 2.0 +# beta = 5.0 +theta = 1.0/4.0 +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +gamma = '0' +# gamma = 'infinity' +# gamma = 0.5 +# gamma = 0.25 +# gamma = 1.0 + +# gamma = 5.0 + +#added +# lambda1 = 10.0 +lambda1 = 0.0 + +#Test: +# rho1 = -1.0 + + + +print('---- Input parameters: -----') +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) + +print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- + +# +# gamma_min = 0.5 +# gamma_max = 1.0 +# +# # gamma_min = 1 +# # gamma_max = 1 +# Gamma_Values = np.linspace(gamma_min, gamma_max, num=3) +# # # +# # # Gamma_Values = np.linspace(gamma_min, gamma_max, num=13) # TODO variable Input Parameters...alpha,beta... +# print('(Input) Gamma_Values:', Gamma_Values) + +print('type of gamma:', type(gamma)) +# # # +Gamma_Values = ['0', 'infinity'] +# Gamma_Values = ['infinity'] +# Gamma_Values = ['0'] +print('(Input) Gamma_Values:', Gamma_Values) + +for gamma in Gamma_Values: + + print('Run for gamma = ', gamma) + print('type of gamma:', type(gamma)) + # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1,InputFilePath) + # # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1) + # print('Test MuGamma:', muGamma) + + # ------- Options -------- + # print_Cases = True + # print_Output = True + + #TODO + # generalCase = True #Read Output from Cell-Problem instead of using Lemma1.4 (special case) + generalCase = False + + # make_3D_plot = True + # make_3D_PhaseDiagram = True + make_2D_plot = False + make_2D_PhaseDiagram = False + make_3D_plot = False + make_3D_PhaseDiagram = False + make_2D_plot = True + make_2D_PhaseDiagram = True + # + + # --- Define effective quantities: q1, q2 , q3 = mu_gamma, q12 --- + # q1 = harmonicMean(mu1, beta, theta) + # q2 = arithmeticMean(mu1, beta, theta) + # --- Set q12 + # q12 = 0.0 # (analytical example) # TEST / TODO read from Cell-Output + + + + + + # b1 = prestrain_b1(rho1, beta, alpha, theta) + # b2 = prestrain_b2(rho1, beta, alpha, theta) + # + # print('---- Input parameters: -----') + # print('mu1: ', mu1) + # print('rho1: ', rho1) + # print('alpha: ', alpha) + # print('beta: ', beta) + # print('theta: ', theta) + # print("q1: ", q1) + # print("q2: ", q2) + # print("mu_gamma: ", mu_gamma) + # print("q12: ", q12) + # print("b1: ", b1) + # print("b2: ", b2) + # print('----------------------------') + # print("machine epsilon", sys.float_info.epsilon) + + # G, angle, type, kappa = classifyMin(q1, q2, mu_gamma, q12, b1, b2, print_Cases, print_Output) + # Test = f(1,2 ,q1,q2,mu_gamma,q12,b1,b2) + # print("Test", Test) + + # ---------------------- MAKE PLOT / Write to VTK------------------------------------------------------------------------------ + + # SamplePoints_3D = 10 # Number of sample points in each direction + # SamplePoints_2D = 10 # Number of sample points in each direction + SamplePoints_3D = 300 # Number of sample points in each direction + # SamplePoints_3D = 150 # Number of sample points in each direction + # SamplePoints_3D = 100 # Number of sample points in each direction + # SamplePoints_3D = 200 # Number of sample points in each direction + # SamplePoints_3D = 400 # Number of sample points in each direction + # SamplePoints_2D = 7500 # Number of sample points in each direction + # SamplePoints_2D = 4000 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 400 # 4000 # Number of sample points in each direction + SamplePoints_2D = 500 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 100 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 2000 # 4000 # Number of sample points in each direction + # SamplePoints_2D = 1000 # 4000 # Number of sample points in each direction + + if make_3D_PhaseDiagram: + alphas_ = np.linspace(-20, 20, SamplePoints_3D) + # alphas_ = np.linspace(-10, 10, SamplePoints_3D) + + # betas_ = np.linspace(0.01,40.01,SamplePoints_3D) # Full Range + # betas_ = np.linspace(0.01,20.01,SamplePoints_3D) # FULL Range + + + + # betas_ = np.linspace(0.01,0.99,SamplePoints_3D) # weird part + betas_ = np.linspace(1.01,40.01,SamplePoints_3D) #TEST !!!!! For Beta <1 weird tings happen... + thetas_ = np.linspace(0.01,0.99,SamplePoints_3D) + + + # TEST + # alphas_ = np.linspace(-2, 2, SamplePoints_3D) + # betas_ = np.linspace(1.01,10.01,SamplePoints_3D) + # print('betas:', betas_) + + # TEST : + # alphas_ = np.linspace(-40, 40, SamplePoints_3D) + # betas_ = np.linspace(0.01,80.01,SamplePoints_3D) # Full Range + + # print('type of alphas', type(alphas_)) + # print('Test:', type(np.array([mu_gamma])) ) + alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') + classifyMin_anaVec = np.vectorize(classifyMin_ana) + + # Get MuGamma values ... + GetMuGammaVec = np.vectorize(GetMuGamma) + muGammas = GetMuGammaVec(betas, thetas, gamma, mu1, rho1) + # Classify Minimizers.... + G, angles, Types, curvature = classifyMin_anaVec(alphas, betas, thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + + # G, angles, Types, curvature = classifyMin_anaVec(alphas, betas, thetas, muGammas, mu1, rho1, True, True) + # print('size of G:', G.shape) + # print('G:', G) + + # Option to print angles + # print('angles:', angles) + + + # Out = classifyMin_anaVec(alphas,betas,thetas) + # T = Out[2] + # --- Write to VTK + + GammaString = str(gamma) + VTKOutputName = "outputs/PhaseDiagram3D" + "Gamma" + GammaString + gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) + print('Written to VTK-File:', VTKOutputName ) + + if make_2D_PhaseDiagram: + # alphas_ = np.linspace(-20, 20, SamplePoints_2D) + # alphas_ = np.linspace(0, 1, SamplePoints_2D) + thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) + alphas_ = np.linspace(-5, 5, SamplePoints_2D) + # alphas_ = np.linspace(-5, 15, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.25,SamplePoints_2D) + + + # good range: + # alphas_ = np.linspace(9, 10, SamplePoints_2D) + # thetas_ = np.linspace(0.075,0.14,SamplePoints_2D) + + # range used: + # alphas_ = np.linspace(8, 10, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.16,SamplePoints_2D) + + # alphas_ = np.linspace(8, 12, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.2,SamplePoints_2D) + # betas_ = np.linspace(0.01,40.01,1) + #fix to one value: + betas_ = 2.0; + # betas_ = 10.0; + # betas_ = 5.0; + # betas_ = 0.5; + + + #intermediate Values + alphas_ = np.linspace(-2, 1, SamplePoints_2D) + # thetas_ = np.linspace(0.4,0.6,SamplePoints_2D) + # betas_ = 10.0; + + # TEST + # alphas_ = np.linspace(-8, 8, SamplePoints_2D) + # thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) + # betas_ = 1.0; #TEST Problem: disvison by zero if alpha = 9, theta = 0.1 ! + # betas_ = 0.9; + # betas_ = 0.5; #TEST!!! + # alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') + betas = betas_ + alphas, thetas = np.meshgrid(alphas_, thetas_, indexing='ij') + + if generalCase: + classifyMin_matVec = np.vectorize(classifyMin_mat) + GetCellOutputVec = np.vectorize(GetCellOutput, otypes=[np.ndarray, np.ndarray]) + Q, B = GetCellOutputVec(alphas,betas,thetas,gamma,mu1,rho1,lambda1, InputFilePath ,OutputFilePath ) + + + # print('type of Q:', type(Q)) + # print('Q:', Q) + G, angles, Types, curvature = classifyMin_matVec(Q,B) + + else: + classifyMin_anaVec = np.vectorize(classifyMin_ana) + GetMuGammaVec = np.vectorize(GetMuGamma) + # muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) + # G, angles, Types, curvature = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) + + if gamma == '0': + G, angles_0, Types, curvature_0 = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + if gamma == 'infinity': + G, angles_inf, Types, curvature_inf = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + + # print('size of G:', G.shape) + # print('G:', G) + # print('Types:', Types) + # Out = classifyMin_anaVec(alphas,betas,thetas) + # T = Out[2] + # --- Write to VTK + # VTKOutputName = + path + "./PhaseDiagram2DNEW" + + # print('angles:',angles) + # GammaString = str(gamma) + # VTKOutputName = "outputs/PhaseDiagram2D" + "Gamma_" + GammaString + # gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) + # print('Written to VTK-File:', VTKOutputName ) + + +# --- Make 3D Scatter plot +if(make_3D_plot or make_2D_plot): + # fig = plt.figure() + # ax = fig.add_subplot(111, projection='3d') + # colors = cm.plasma(Types) + colors = cm.coolwarm(angles_inf) + + + width = 6.28 + # height = width / 1.618 + height = width / 2.5 + # fig, ax = plt.subplots() + fig,ax = plt.subplots(nrows=1,ncols=2,figsize=(width,height), sharey=True) + # ax = plt.axes((0.15,0.21 ,0.8,0.75)) + + + + + # if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=Types.flat) + # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=Types.flat) + # + # if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=angles.flat) + # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=angles.flat) + + + # pnt=ax.scatter(alphas,thetas,c=angles,cmap='coolwarm') + # # ax.colorbar() + # CS = ax.contourf(alphas, thetas, angles,6, cmap=plt.cm.coolwarm, linestyle=dashed) + # # CS = ax.contour(alphas, thetas, angles,6, colors='k') + # ax.clabel(CS, inline=True, fontsize=7.5) + # # ax.set_title('Simplest default with labels') + + + # CS_0 = ax[0].contourf(alphas, thetas, curvature_0, 10, cmap=plt.cm.coolwarm) + CS_0 = ax[0].contourf(alphas, thetas, curvature_0, 10, cmap=plt.cm.gnuplot) + # CS = ax.contourf(alphas, thetas, angles, 10, cmap='RdBu') + CS_02 = ax[0].contour(CS_0, levels=CS_0.levels[::2], colors='black',inline=True, linewidths=(0.5,)) + # ax.clabel(CS2, inline=True, fontsize=9, colors='black') + # ax.clabel(CS2, inline=True, inline_spacing=3, rightside_up=True, colors='k', fontsize=8) + # manual_locations = [ + # (-0.5, 0.3), (-0.7, 0.4), (-0.8, 0.5), (-0.9, 0.6), (-1,0.7)] + manual_locations = [ + (-0.4, 0.2),(-0.6, 0.3), (-0.7, 0.4), (-0.8, 0.5), (-0.9, 0.6), (-1,0.7)] + # ax[0].clabel(CS_02, inline=True, fontsize=6, colors='black', manual=manual_locations) + # ax[0].clabel(CS_02, inline=True, fontsize=10, colors='black') + + + + # ax.clabel(CS2, CS2.levels, inline=True, fontsize=10) + # ax.clabel(CS, fontsize=5, colors='black') + # cbar = fig.colorbar(CS,label=r'angle $\alpha$', ticks=[0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) + # cbar = fig.colorbar(CS_0, ticks=[0, np.pi/2 ]) + # cbar.ax.set_yticklabels(['$0$', r'$\pi/2$']) + # cbar.ax.set_title(r'angle $\alpha$') + + + CS_1 = ax[1].contourf(alphas, thetas, curvature_inf, 10, cmap=plt.cm.gnuplot) + # CS_1 = ax[1].contourf(alphas, thetas, curvature_inf, 10, cmap=plt.cm.jet) + # CS = ax.contourf(alphas, thetas, angles, 10, cmap='RdBu') + CS_12 = ax[1].contour(CS_1, levels=CS_1.levels[::2], colors='black',inline=True, linewidths=(0.5,)) + # ax.clabel(CS2, inline=True, fontsize=9, colors='black') + # ax.clabel(CS2, inline=True, inline_spacing=3, rightside_up=True, colors='k', fontsize=8) + manual_locations = [ + (-1.8,0.9), (-1.5,0.4), (-1,0.3), (0,0.15),(0,0.67) ,(0.5,0.75) , (0.5,0.8), (0.8,0.9) ] + # ax[1].clabel(CS_12, inline=True, fontsize=10, colors='black', manual=manual_locations) + # ax[1].clabel(CS_12, inline=True, fontsize=10, colors='black') + + + axins1 = inset_axes(ax[1], + width="5%", # width = 5% of parent_bbox width + height="100%", # height : 50% + loc='lower left', + bbox_to_anchor=(1.05, 0., 1, 1), + bbox_transform=ax[1].transAxes, + borderpad=0, + ) + + + # cbar = fig.colorbar(CS_1, cax=axins1, ticks=[0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) + cbar = fig.colorbar(CS_1, cax=axins1) + cbar.ax.tick_params(labelsize=8) + + + # cbar.ax.set_yticklabels(['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$']) + # cbar.ax.set_title(r'angle $\alpha$') + # cbar.ax.set_title(r'curvature $\kappa$') + cbar.ax.set_title(r'$\kappa$') + # cbar=plt.colorbar(pnt3d) + # cbar.set_label("Values (units)") + # plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 0.083333333, color = 'b', linestyle = ':', label='$q_1$') + + ax[0].set_xlabel(r'$\theta_\rho$',fontsize=10) + # ax[0].yaxis.set_major_locator(MultipleLocator(0.1)) + # ax[0].xaxis.set_major_locator(MultipleLocator(1)) + ax[0].yaxis.set_major_locator(MultipleLocator(0.1)) + ax[0].xaxis.set_major_locator(MultipleLocator(0.5)) + ax[0].set_ylabel(r'$\theta$ ',fontsize=10, rotation=0) + ax[0].tick_params(axis='x', labelsize=7 ) + ax[0].tick_params(axis='y', labelsize=7 ) + + ax[1].set_xlabel(r'$\theta_\rho$',fontsize=10) + # ax.xaxis.set_minor_locator(MultipleLocator(0.5)) + # ax[1].yaxis.set_major_locator(MultipleLocator(0.1)) + # ax[1].xaxis.set_major_locator(MultipleLocator(1)) + ax[1].yaxis.set_major_locator(MultipleLocator(0.1)) + ax[1].xaxis.set_major_locator(MultipleLocator(0.5)) + ax[1].tick_params(axis='x', labelsize=7 ) + ax[1].tick_params(axis='y', labelsize=7 ) + # ax.set_ylabel('beta') + # ax[1].set_ylabel(r'$\theta$ ',fontsize=10, rotation=0) + # if make_3D_plot: ax.set_zlabel('theta') + # plt.subplots_adjust(bottom=0.2) + # plt.subplots_adjust(wspace=0.22, hspace=0.1) + plt.subplots_adjust(hspace=0.15, wspace=0.1) + # plt.subplots_adjust(hspace=0.15, wspace=0.0) + plt.subplots_adjust(bottom=0.2) + # plt.subplots_adjust(right=0.1) + # fig.subplots_adjust(right=0.1) + + + ax[0].grid( linestyle = '--', linewidth = 0.25) + ax[1].grid( linestyle = '--', linewidth = 0.25) + + + + fig.set_size_inches(width, height) + outputName = 'Plot-CurvContour.pdf' + fig.savefig(outputName) + # fig.savefig('Plot-Contour.pdf') + plt.show() + # plt.savefig('common_labels.png', dpi=300) + # print('T:', T) + # print('Type 1 occured here:', np.where(T == 1)) + # print('Type 2 occured here:', np.where(T == 2)) diff --git a/src/PhaseDiagram_PlotScriptV3.py b/src/PhaseDiagram_PlotScriptV3.py index 6931af4cfa64b268def1fc45ac10a90e504787b9..e415b54b8cd43ed71491e7a8a579f0def2190076 100644 --- a/src/PhaseDiagram_PlotScriptV3.py +++ b/src/PhaseDiagram_PlotScriptV3.py @@ -22,7 +22,8 @@ curvature = 0 hide_redcolor = True -# hide_redcolor = False +hide_redcolor = False +hide_legend = True gamma = 'infinity' gamma = '0' @@ -864,69 +865,140 @@ if gamma == '0': if hide_redcolor: # get color transfer function/color map for 'angles' anglesLUT = GetColorTransferFunction('angles') - anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" - anglesLUT.InterpretValuesAsCategories = 1 - anglesLUT.AnnotationsInitialized = 1 - anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 - anglesLUT.RescaleOnVisibilityChange = 0 anglesLUT.EnableOpacityMapping = 1 - anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] - anglesLUT.UseLogScale = 0 - anglesLUT.ColorSpace = 'Diverging' - anglesLUT.UseBelowRangeColor = 0 - anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] - anglesLUT.UseAboveRangeColor = 0 - anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] - anglesLUT.NanColor = [1.0, 1.0, 0.0] - anglesLUT.NanOpacity = 1.0 - anglesLUT.Discretize = 1 - anglesLUT.NumberOfTableValues = 256 + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + anglesLUT.ColorSpace = 'Lab' + anglesLUT.NanColor = [0.250004, 0.0, 0.0] anglesLUT.ScalarRangeInitialized = 1.0 - anglesLUT.HSVWrap = 0 - anglesLUT.VectorComponent = 0 - anglesLUT.VectorMode = 'Magnitude' - anglesLUT.AllowDuplicateScalars = 1 - anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] - anglesLUT.ActiveAnnotatedValues = ['0'] - anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.8313725490196079, 0.0, 0.0392156862745098] - anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] - # Properties modified on anglesLUT - anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] - anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.8313725490196079, 0.0, 0.0392156862745098] - anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0] + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Preset', True) # get opacity transfer function/opacity map for 'angles' anglesPWF = GetOpacityTransferFunction('angles') - anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] - anglesPWF.AllowDuplicateScalars = 1 - anglesPWF.UseLogScale = 0 + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] anglesPWF.ScalarRangeInitialized = 1 - # Properties modified on anglesLUT - anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] - anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451] - anglesLUT.IndexedOpacities = [0.1, 1.0] + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesPWF.ApplyPreset('Preset', True) + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] # Properties modified on anglesLUT - anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 0.12549019607843137, 0.0, 0.3803921568627451] + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] # Properties modified on anglesLUT - anglesLUT.IndexedOpacities = [0.0, 1.0] + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.996078431372549, 0.9921568627450981, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] - # get active source. - transform1 = GetActiveSource() + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] - # get active view - renderView1 = GetActiveViewOrCreate('RenderView') - # uncomment following to set a specific view size - # renderView1.ViewSize = [1257, 934] + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + ### + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + anglesLUT.NanColor = [0.250004, 0.0, 0.0] + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] - # get display properties - transform1Display = GetDisplayProperties(transform1, view=renderView1) + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 - # Properties modified on transform1Display - transform1Display.Opacity = 1.0 + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.036764707416296005, 0.5, 0.0] + + + + + + # ## ------------------------- + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + # anglesLUT.InterpretValuesAsCategories = 1 + # anglesLUT.AnnotationsInitialized = 1 + # anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 + # anglesLUT.RescaleOnVisibilityChange = 0 + # anglesLUT.EnableOpacityMapping = 1 + # anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + # anglesLUT.UseLogScale = 0 + # anglesLUT.ColorSpace = 'Diverging' + # anglesLUT.UseBelowRangeColor = 0 + # anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] + # anglesLUT.UseAboveRangeColor = 0 + # anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] + # anglesLUT.NanColor = [1.0, 1.0, 0.0] + # anglesLUT.NanOpacity = 1.0 + # anglesLUT.Discretize = 1 + # anglesLUT.NumberOfTableValues = 256 + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.HSVWrap = 0 + # anglesLUT.VectorComponent = 0 + # anglesLUT.VectorMode = 'Magnitude' + # anglesLUT.AllowDuplicateScalars = 1 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] + # anglesLUT.ActiveAnnotatedValues = ['0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + # + # # Properties modified on anglesLUT + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0] + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + # anglesPWF.AllowDuplicateScalars = 1 + # anglesPWF.UseLogScale = 0 + # anglesPWF.ScalarRangeInitialized = 1 + # + # # Properties modified on anglesLUT + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451] + # anglesLUT.IndexedOpacities = [0.1, 1.0] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 0.12549019607843137, 0.0, 0.3803921568627451] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedOpacities = [0.0, 1.0] + # + # # get active source. + # transform1 = GetActiveSource() + # + # # get active view + # renderView1 = GetActiveViewOrCreate('RenderView') + # # uncomment following to set a specific view size + # # renderView1.ViewSize = [1257, 934] + # + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesPWF.ApplyPreset('Preset 6', True) + + + if hide_legend: + # get display properties + transform1Display = GetDisplayProperties(transform1, view=renderView1) + + # hide color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, False) @@ -1008,7 +1080,7 @@ if gamma == 'infinity': #TEST anglesLUT.ApplyPreset('Warm to Cool (Extended)', True) #TEST - anglesLUT.ApplyPreset('jet', True) + # anglesLUT.ApplyPreset('jet', True) # invert the transfer function anglesLUT.InvertTransferFunction() @@ -1111,71 +1183,136 @@ if gamma == 'infinity': #TEST if hide_redcolor: - # get display properties - transform1Display = GetDisplayProperties(transform1, view=renderView1) - - # Properties modified on transform1Display - transform1Display.Opacity = 1.0 - # get color transfer function/color map for 'angles' anglesLUT = GetColorTransferFunction('angles') + anglesLUT.EnableOpacityMapping = 1 anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] anglesLUT.ColorSpace = 'Lab' anglesLUT.NanColor = [0.250004, 0.0, 0.0] anglesLUT.ScalarRangeInitialized = 1.0 - anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Preset', True) + # get opacity transfer function/opacity map for 'angles' anglesPWF = GetOpacityTransferFunction('angles') - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.4117647111415863, 0.5, 0.0] + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] anglesPWF.ScalarRangeInitialized = 1 - # Properties modified on anglesLUT - anglesLUT.EnableOpacityMapping = 1 + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesPWF.ApplyPreset('Preset', True) # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.41911765933036804, 0.5, 0.0] + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] - # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.375, 0.5, 0.0] + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] - # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.3602941334247589, 0.5, 0.0] + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.996078431372549, 0.9921568627450981, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] - # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.14705882966518402, 0.5, 0.0] + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] - # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.125, 0.5, 0.0] - # Properties modified on anglesPWF - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] - #### saving camera placements for all active views + + ### # get color transfer function/color map for 'angles' anglesLUT = GetColorTransferFunction('angles') anglesLUT.EnableOpacityMapping = 1 - anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] - anglesLUT.ColorSpace = 'Lab' + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] anglesLUT.NanColor = [0.250004, 0.0, 0.0] anglesLUT.ScalarRangeInitialized = 1.0 - anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] - # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. - # anglesLUT.ApplyPreset('jet', True) - - # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. - anglesPWF.ApplyPreset('Preset 5', True) - # get opacity transfer function/opacity map for 'angles' anglesPWF = GetOpacityTransferFunction('angles') - anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] anglesPWF.ScalarRangeInitialized = 1 + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.036764707416296005, 0.5, 0.0] + + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.03, 0.5, 0.0] + + #### uncomment the following to render all views + #### uncomment the following to render all views + +#### uncomment the following to render all views + ## ------------------------------------------ + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.ColorSpace = 'Lab' + # anglesLUT.NanColor = [0.250004, 0.0, 0.0] + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + # anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.4117647111415863, 0.5, 0.0] + # anglesPWF.ScalarRangeInitialized = 1 + # + # # Properties modified on anglesLUT + # anglesLUT.EnableOpacityMapping = 1 + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.41911765933036804, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.375, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.3602941334247589, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.14705882966518402, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.125, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] + # + # #### saving camera placements for all active views + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.EnableOpacityMapping = 1 + # anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.ColorSpace = 'Lab' + # anglesLUT.NanColor = [0.250004, 0.0, 0.0] + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + # anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # # anglesLUT.ApplyPreset('jet', True) + # + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] + # anglesPWF.ScalarRangeInitialized = 1 + if curvature == 1: # set scalar coloring diff --git a/src/PhaseDiagram_PlotScriptV4.py b/src/PhaseDiagram_PlotScriptV4.py new file mode 100644 index 0000000000000000000000000000000000000000..52df7ae0cb833ab4869ac764cfe3cd5cc4c632b0 --- /dev/null +++ b/src/PhaseDiagram_PlotScriptV4.py @@ -0,0 +1,1594 @@ +# To ensure correct image size when batch processing, please search +# for and uncomment the line `# renderView*.ViewSize = [*,*]` + +#### import the simple module from the paraview +from paraview.simple import * +#### disable automatic camera reset on 'Show' +paraview.simple._DisableFirstRenderCameraReset() + +#--- Run in Terminal with: 'pvbatch PhaseDiagram_PlotScript.py' + + +# ----- CREATE A Phase Diagram for the following cases: +# 1. (Hyperbolic Case) Gamma = '0' +# 2. (Elliptic Case) Gamma = 'infinity' +# +# case = 1 +# case = 2 +# +drawLine = False + +curvature = 1 + + +hide_redcolor = True +# hide_redcolor = False +hide_legend = True + +gamma = 'infinity' +# gamma = '0' + +# create a new 'XML Structured Grid Reader' +# if case == 1: +if gamma == '0': + phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0.vts']) + + +# if case == 2: +elif gamma == 'infinity': + # phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0.vts']) + phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity.vts']) + +# create a new 'XML Structured Grid Reader' +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity_100SP.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity_300p.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinityBetaSmallerOne.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0_300p.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity_greaterOne.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0_greaterOne.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity_300SpMu1.vts']) +#phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGamma0_300spmu1.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/beforePrestrainChange/PhaseDiagram3DGammainfinity_100spmu1.vts']) +# phaseDiagram3DGammainfinityvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram3DGammainfinity150P.vts']) + + +phaseDiagram3DGammainfinityvts.PointArrayStatus = ['Type', 'angles', 'curvature'] + +# get active view +renderView1 = GetActiveViewOrCreate('RenderView') +# uncomment following to set a specific view size +# renderView1.ViewSize = [999, 547] + +## ---- Set a specific view size: +renderView1.ViewSize = [1257, 934] + +# show data in view +phaseDiagram3DGammainfinityvtsDisplay = Show(phaseDiagram3DGammainfinityvts, renderView1) + +# trace defaults for the display properties. +phaseDiagram3DGammainfinityvtsDisplay.Representation = 'Outline' +phaseDiagram3DGammainfinityvtsDisplay.ColorArrayName = ['POINTS', ''] +phaseDiagram3DGammainfinityvtsDisplay.OSPRayScaleArray = 'Type' +phaseDiagram3DGammainfinityvtsDisplay.OSPRayScaleFunction = 'PiecewiseFunction' +phaseDiagram3DGammainfinityvtsDisplay.SelectOrientationVectors = 'None' +phaseDiagram3DGammainfinityvtsDisplay.ScaleFactor = 4.0 +phaseDiagram3DGammainfinityvtsDisplay.SelectScaleArray = 'Type' +phaseDiagram3DGammainfinityvtsDisplay.GlyphType = 'Arrow' +phaseDiagram3DGammainfinityvtsDisplay.GlyphTableIndexArray = 'Type' +phaseDiagram3DGammainfinityvtsDisplay.GaussianRadius = 0.2 +phaseDiagram3DGammainfinityvtsDisplay.SetScaleArray = ['POINTS', 'Type'] +phaseDiagram3DGammainfinityvtsDisplay.ScaleTransferFunction = 'PiecewiseFunction' +phaseDiagram3DGammainfinityvtsDisplay.OpacityArray = ['POINTS', 'Type'] +phaseDiagram3DGammainfinityvtsDisplay.OpacityTransferFunction = 'PiecewiseFunction' +phaseDiagram3DGammainfinityvtsDisplay.DataAxesGrid = 'GridAxesRepresentation' +phaseDiagram3DGammainfinityvtsDisplay.PolarAxes = 'PolarAxesRepresentation' +phaseDiagram3DGammainfinityvtsDisplay.ScalarOpacityUnitDistance = 1.1546332790816523 + +# init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction' +phaseDiagram3DGammainfinityvtsDisplay.OSPRayScaleFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.213836476688135, 0.625, 0.5, 0.0, 1.3616352081298828, 0.6691176295280457, 0.5, 0.0, 1.6666333299996667, 0.8676470518112183, 0.5, 0.0, 1.7358490228652954, 0.6911764740943909, 0.5, 0.0, 2.0, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' +phaseDiagram3DGammainfinityvtsDisplay.ScaleTransferFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.4276729533762702, 0.625, 0.5, 0.0, 1.7232704162597656, 0.6691176295280457, 0.5, 0.0, 2.3332666599993335, 0.8676470518112183, 0.5, 0.0, 2.471698045730591, 0.6911764740943909, 0.5, 0.0, 3.0, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' +phaseDiagram3DGammainfinityvtsDisplay.OpacityTransferFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.4276729533762702, 0.625, 0.5, 0.0, 1.7232704162597656, 0.6691176295280457, 0.5, 0.0, 2.3332666599993335, 0.8676470518112183, 0.5, 0.0, 2.471698045730591, 0.6911764740943909, 0.5, 0.0, 3.0, 0.8014705777168274, 0.5, 0.0] + +# reset view to fit data +renderView1.ResetCamera() + +# update the view to ensure updated data information +renderView1.Update() + +# create a new 'Transform' +transform1 = Transform(Input=phaseDiagram3DGammainfinityvts) +transform1.Transform = 'Transform' + +# Properties modified on transform1.Transform +transform1.Transform.Scale = [0.025, 0.025, 1.0] + +# Properties modified on transform1.Transform +# transform1.Transform.Scale = [0.025, 1.0, 1.0] + +# show data in view +transform1Display = Show(transform1, renderView1) + +# trace defaults for the display properties. +transform1Display.Representation = 'Outline' +transform1Display.ColorArrayName = ['POINTS', ''] +transform1Display.OSPRayScaleArray = 'Type' +transform1Display.OSPRayScaleFunction = 'PiecewiseFunction' +transform1Display.SelectOrientationVectors = 'None' +transform1Display.ScaleFactor = 0.1 +transform1Display.SelectScaleArray = 'Type' +transform1Display.GlyphType = 'Arrow' +transform1Display.GlyphTableIndexArray = 'Type' +transform1Display.GaussianRadius = 0.005 +transform1Display.SetScaleArray = ['POINTS', 'Type'] +transform1Display.ScaleTransferFunction = 'PiecewiseFunction' +transform1Display.OpacityArray = ['POINTS', 'Type'] +transform1Display.OpacityTransferFunction = 'PiecewiseFunction' +transform1Display.DataAxesGrid = 'GridAxesRepresentation' +transform1Display.PolarAxes = 'PolarAxesRepresentation' +transform1Display.ScalarOpacityUnitDistance = 0.035113904022862234 + +# init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction' +transform1Display.OSPRayScaleFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.213836476688135, 0.625, 0.5, 0.0, 1.3616352081298828, 0.6691176295280457, 0.5, 0.0, 1.6666333299996667, 0.8676470518112183, 0.5, 0.0, 1.7358490228652954, 0.6911764740943909, 0.5, 0.0, 2.0, 0.8014705777168274, 0.5, 0.0] +# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' +transform1Display.ScaleTransferFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.4276729533762702, 0.625, 0.5, 0.0, 1.7232704162597656, 0.6691176295280457, 0.5, 0.0, 2.3332666599993335, 0.8676470518112183, 0.5, 0.0, 2.471698045730591, 0.6911764740943909, 0.5, 0.0, 3.0, 0.8014705777168274, 0.5, 0.0] +# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' +transform1Display.OpacityTransferFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.4276729533762702, 0.625, 0.5, 0.0, 1.7232704162597656, 0.6691176295280457, 0.5, 0.0, 2.3332666599993335, 0.8676470518112183, 0.5, 0.0, 2.471698045730591, 0.6911764740943909, 0.5, 0.0, 3.0, 0.8014705777168274, 0.5, 0.0] + +# hide data in view +Hide(phaseDiagram3DGammainfinityvts, renderView1) + +# update the view to ensure updated data information +renderView1.Update() +# +# reset view to fit data +renderView1.ResetCamera() + +# ------------------------------------------------------------- + +# toggle 3D widget visibility (only when running from the GUI) +Hide3DWidgets(proxy=transform1.Transform) + +# set scalar coloring +ColorBy(transform1Display, ('POINTS', 'angles')) + +# rescale color and/or opacity maps used to include current data range +transform1Display.RescaleTransferFunctionToDataRange(True, False) + +# show color bar/color legend +transform1Display.SetScalarBarVisibility(renderView1, True) + +# get color transfer function/color map for 'angles' +anglesLUT = GetColorTransferFunction('angles') + +# get opacity transfer function/opacity map for 'angles' +anglesPWF = GetOpacityTransferFunction('angles') + +# --- change representation type +transform1Display.SetRepresentationType('Point Gaussian') + +# Properties modified on transform1Display +transform1Display.ShaderPreset = 'Plain circle' + +# --- Properties modified on transform1Display +transform1Display.GaussianRadius = 0.0075 +# Properties modified on transform1Display + +##--- SET OPACITY +# transform1Display.Opacity = 0.07 +transform1Display.Opacity = 0.03 #overall Opacity +# transform1Display.Opacity = 0.15 #overall Opacity + +# -------------- CHANGE COLORMAP ------------------ +# Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + +#anglesLUT.ApplyPreset('Cool to Warm', True) +anglesLUT.ApplyPreset('Jet', True) + + + + + +## (Optional?) Adjust ColorMap: +# get opacity transfer function/opacity map for 'angles' +anglesPWF = GetOpacityTransferFunction('angles') # +# get color transfer function +colorMap = GetColorTransferFunction('angles') + +# get color transfer function/color map for 'angles' +anglesLUT = GetColorTransferFunction('angles') +anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" +anglesLUT.InterpretValuesAsCategories = 0 +anglesLUT.AnnotationsInitialized = 0 +anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 +anglesLUT.RescaleOnVisibilityChange = 0 +anglesLUT.EnableOpacityMapping = 1 +anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] +anglesLUT.UseLogScale = 0 +anglesLUT.ColorSpace = 'Diverging' +anglesLUT.UseBelowRangeColor = 0 +anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] +anglesLUT.UseAboveRangeColor = 0 +anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] +anglesLUT.NanColor = [1.0, 1.0, 0.0] +anglesLUT.NanOpacity = 1.0 +anglesLUT.Discretize = 1 +anglesLUT.NumberOfTableValues = 256 +anglesLUT.ScalarRangeInitialized = 1.0 +anglesLUT.HSVWrap = 0 +anglesLUT.VectorComponent = 0 +anglesLUT.VectorMode = 'Magnitude' +anglesLUT.AllowDuplicateScalars = 1 +anglesLUT.Annotations = [] +anglesLUT.ActiveAnnotatedValues = [] +anglesLUT.IndexedColors = [] +anglesLUT.IndexedOpacities = [] + +# get opacity transfer function/opacity map for 'angles' +anglesPWF = GetOpacityTransferFunction('angles') +# anglesPWF.Points = [0.0, 0.05882352963089943, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +anglesPWF.AllowDuplicateScalars = 1 +anglesPWF.UseLogScale = 0 +anglesPWF.ScalarRangeInitialized = 1 + +# Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.3014705777168274, 0.5, 0.0, 0.33589355211648514, 0.625, 0.5, 0.0, 0.5680552565701278, 0.6691176295280457, 0.5, 0.0, 1.0471451860825267, 0.8676470518112183, 0.5, 0.0, 1.15586894219242, 0.6911764740943909, 0.5, 0.0, 1.5707963267948966, 0.8014705777168274, 0.5, 0.0] + + +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.037, 0.5, 1.0, 0.33589355211648514, 0.625, 0.5, 0.0, 0.5680552565701278, 0.6691176295280457, 0.5, 0.0, 1.0471451860825267, 0.8676470518112183, 0.5, 0.0, 1.15586894219242, 0.6911764740943909, 0.5, 0.0, 1.5707963267948966, 0.8014705777168274, 0.5, 0.0] +# Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.036764707416296005, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +anglesPWF.Points = [0.1, 0.136764707416296005, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# rescale color and/or opacity maps used to exactly fit the current data range +transform1Display.RescaleTransferFunctionToDataRange(False, True) +# # Properties modified on anglesPWF +# # anglesPWF.Points = [0.0, 0.036764707416296005, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0570768117917348, 1.0, 0.5, 0.0, 1.1558689421924027, 0.9852941036224365, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.7705793380737305, 0.9779411554336548, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.7656397223472595, 0.9926470518112183, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.9779411554336548, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.9411764740943909, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.904411792755127, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.7573529481887817, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.7426470518112183, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.6838235259056091, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.6764705777168274, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.5955882668495178, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.5735294222831726, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.43382352590560913, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.4264705777168274, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.3897058963775635, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.36764705181121826, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.29411765933036804, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.2867647111415863, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.2647058963775635, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.25, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.2132352888584137, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.1985294073820114, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.16911764442920685, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.1617647111415863, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.13235294818878174, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.11029411852359772, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.10294117778539658, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.09558823704719543, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.06617647409439087, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.05882352963089943, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.05147058889269829, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.036764707416296005, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.029411764815449715, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.06617647409439087, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.07352941483259201, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.05147058889269829, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.04411764815449715, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# +# # Properties modified on anglesPWF +# anglesPWF.Points = [0.0, 0.036764707416296005, 0.5, 0.0, 0.7607001066207886, 1.0, 0.5, 0.0, 0.8693715333938599, 1.0, 0.5, 0.0, 1.0175598859786987, 1.0, 0.5, 0.0, 1.12623131275177, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + + +# Properties modified on anglesLUT +anglesLUT.EnableOpacityMapping = 0 +anglesLUT.EnableOpacityMapping = 1 + + + +## ---- AXES GRID PROPERTIES ----- +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.Visibility = 1 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.XTitle = ' $\\theta_\\rho$ ' +renderView1.AxesGrid.YTitle = ' $\\theta_\\mu$ ' +renderView1.AxesGrid.ZTitle = ' $\\theta$ ' + +# renderView1.AxesGrid.XTitleFontSize = 45 #24 +# renderView1.AxesGrid.YTitleFontSize = 45 +# renderView1.AxesGrid.ZTitleFontSize = 45 +# renderView1.AxesGrid.XLabelFontSize = 30 #default:12 +# renderView1.AxesGrid.YLabelFontSize = 30 +# renderView1.AxesGrid.ZLabelFontSize = 30 + +renderView1.AxesGrid.XTitleFontSize = 65 #24 +renderView1.AxesGrid.YTitleFontSize = 65 +renderView1.AxesGrid.ZTitleFontSize = 65 +renderView1.AxesGrid.XLabelFontSize = 45 #default:12 +renderView1.AxesGrid.YLabelFontSize = 45 +renderView1.AxesGrid.ZLabelFontSize = 45 + +# ---- Switch of/on OrientationAXES: +# renderView1.OrientationAxesVisibility = 1 +renderView1.OrientationAxesVisibility = 0 +# rv = GetRenderView() +# renderView1.OrientationAxesLabelColor = [0.5, 0.5, 0.5] +# Render() + +# ---- Switch Grid On/Off: +renderView1.AxesGrid.ShowGrid = 1 + +# # reset view to fit data +# renderView1.ResetCamera() + + +## Properties modified on renderView1.AxesGrid +## -- COLOR/Font-Size OF AXES-TITLE: +## -- Green: +# renderView1.AxesGrid.XTitleColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +# renderView1.AxesGrid.YTitleColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +# renderView1.AxesGrid.ZTitleColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +## -- White: +# renderView1.AxesGrid.XTitleColor = [1.0, 1.0, 1.0] +# renderView1.AxesGrid.YTitleColor = [1.0, 1.0, 1.0] +# renderView1.AxesGrid.ZTitleColor = [1.0, 1.0, 1.0] + + + +# Properties modified on renderView1.AxesGrid +# --- Change FontSize of Values on Axis: + + +# # --- Change Color of Values on Axis: +## -- Green: +# # renderView1.AxesGrid.XLabelColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +# # renderView1.AxesGrid.YLabelColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +# # renderView1.AxesGrid.ZLabelColor = [0.5411764705882353, 0.8862745098039215, 0.20392156862745098] +## -- White: +renderView1.AxesGrid.XLabelColor = [1.0, 1.0, 1.0] +renderView1.AxesGrid.YLabelColor = [1.0, 1.0, 1.0] +renderView1.AxesGrid.ZLabelColor = [1.0, 1.0, 1.0] + +## --- Render Axes only on certain Facets: +renderView1.AxesGrid.FacesToRender = 7 +renderView1.AxesGrid.ShowEdges = 0 +renderView1.AxesGrid.AxesToLabel = 24 + + +## ----------- Scale Data on Axes: +renderView1.AxesGrid.DataScale = [0.025, 0.025, 1.0] +# +# # Properties modified on renderView1.AxesGrid +## ---------- Set Custom Axis-Labels: +renderView1.AxesGrid.XAxisUseCustomLabels = 1 +renderView1.AxesGrid.ZAxisUseCustomLabels = 1 +renderView1.AxesGrid.YAxisUseCustomLabels = 1 +renderView1.AxesGrid.XAxisLabels = [-20, -15.0, -10.0, -5.0, 0.0, 5.0, 10.0, 15.0, 20.0] +# renderView1.AxesGrid.YAxisLabels = [0 , 10.0, 20.0, 30.0, 40.0] +# renderView1.AxesGrid.YAxisLabels = [1 ,5, 10.0,15, 20.0,25, 30.0,35, 40.0] +renderView1.AxesGrid.YAxisLabels = [1 , 10, 20, 30, 40] +# renderView1.AxesGrid.YAxisLabels = [0 ,5.0, 10.0, 15.0, 20.0, 25.0, 30.0,35.0, 40.0] +renderView1.AxesGrid.ZAxisLabels = [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] + + +## ---- SET Center-Axis visible: +renderView1.CenterAxesVisibility = 0 + +# ----------------- CAMERA POSITION ----------------- +# current camera placement for renderView1 +# renderView1.CameraPosition = [0.9924119707463583, 3.796427396663517, 1.5103327925582364] +# renderView1.CameraFocalPoint = [0.0, 0.5002500000000001, 0.5] +# renderView1.CameraViewUp = [-0.03762445763524004, -0.2824789551065148, 0.9585353619505051] +# renderView1.CameraParallelScale = 0.93323050610355 + +renderView1.CameraPosition = [1.320702817430001, 3.4031687433379654, 1.5124027164700495] +renderView1.CameraFocalPoint = [5.999081648913413e-18, 0.5002500000000002, 0.4999999999999999] +renderView1.CameraViewUp = [-0.09506057625109621, -0.2889757851908078, 0.9526051030811066] +renderView1.CameraParallelScale = 0.8660254037844386 +renderView1.EyeAngle = 0.0 + +renderView1.Update() + +## uncomment the following to render all views # TODO ? +# RenderAllViews() + +# # get active view +# # renderView1 = GetActiveViewOrCreate('RenderView') + + + + + + + +# ----------------- DRAW LINE ----------------- +if drawLine: + # create a new 'Line' + line1 = Line() + + # show data in view + line1Display = Show(line1, renderView1) + # set active source + SetActiveSource(line1) + + # Properties modified on line1 + line1.Point1 = [0.25, 0.25, 0.0] + line1.Point2 = [0.25, 0.25, 1.0] + + # Properties modified on line1Display + # line1Display.LineWidth = 2.0 + line1Display.LineWidth = 4.0 + + # change solid color + line1Display.AmbientColor = [1.0, 1.0, 0.4980392156862745] + line1Display.DiffuseColor = [1.0, 1.0, 0.4980392156862745] + + # toggle 3D widget visibility (only when running from the GUI) + Show3DWidgets(proxy=line1) + + # update the view to ensure updated data information + renderView1.Update() + + # # reset view to fit data + # renderView1.ResetCamera() + + +# ----------------- DRAW Plane ----------------- +# # create a new 'Plane' +# plane2 = Plane() +# plane2.Origin = [0.0, 0.0, 0.0] +# plane2.Point1 = [0.0, 0.0, 1.0] +# plane2.Point2 = [0.0, 1.0, 0.0] +# plane2.XResolution = 1 +# plane2.YResolution = 1 +# +# # show data in view +# plane2Display = Show(plane2, renderView1) +# ----------------- LEGEND ----------------- +# get color legend/bar for anglesLUT in view renderView1 +anglesLUTColorBar = GetScalarBar(anglesLUT, renderView1) + +# Properties modified on anglesLUTColorBar +anglesLUTColorBar.WindowLocation = 'LowerRightCorner' +anglesLUTColorBar.HorizontalTitle = 1 +anglesLUTColorBar.Title = 'angle $\\alpha$' #'angle $\\angle$' +anglesLUTColorBar.TextPosition = 'Ticks left/bottom, annotations right/top' +anglesLUTColorBar.TitleJustification = 'Left' +# anglesLUTColorBar.TitleJustification = 'Centered' + +# show color bar/color legend +# transform1Display.SetScalarBarVisibility(renderView1, True) + +# # # Properties modified on anglesLUTColorBar +anglesLUTColorBar.AutomaticAnnotations = 0 +anglesLUTColorBar.AddRangeLabels = 0 +anglesLUTColorBar.DrawTickMarks = 0 +anglesLUTColorBar.DrawTickLabels = 0 +anglesLUTColorBar.TitleFontSize = 24 +anglesLUTColorBar.LabelFontSize = 20 +# anglesLUTColorBar.AddRangeAnnotations = 1 + +## -- Add Annotations : +anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] +anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] +anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0, 1.0] + + + + + + + + + + + + + + + + + + + + + +# # get color legend/bar for anglesLUT in view renderView1 +# anglesLUTColorBar = GetScalarBar(anglesLUT, renderView1) + +# +# if case == 1: +# ## In Hyperbolic Case only two angles occur... +# # Use discrete Color map: +# # # Properties modified on anglesLUT +# # anglesLUT.InterpretValuesAsCategories = 1 +# # anglesLUT.AnnotationsInitialized = 1 +# # +# # +# # +# # # Properties modified on anglesLUT +# # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] +# # # Properties modified on anglesLUT +# # anglesLUT.IndexedColors = [1.0, 0.10196078431372549, 0.023529411764705882, 0.03137254901960784, 0.03137254901960784, 1.0] +# # # Properties modified on anglesLUT +# # anglesLUT.IndexedOpacities = [1.0, 0.015] +# # # get active view +# # renderView1 = GetActiveViewOrCreate('RenderView') +# # # uncomment following to set a specific view size +# # # renderView1.ViewSize = [997, 905] +# # +# # # get display properties +# transform1Display = GetDisplayProperties(transform1, view=renderView1) +# print('Hyperbolic Case (case1)') +# +# # get color transfer function/color map for 'angles' +# anglesLUT = GetColorTransferFunction('angles') +# anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" +# anglesLUT.InterpretValuesAsCategories = 1 +# anglesLUT.AnnotationsInitialized = 1 +# anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 +# anglesLUT.RescaleOnVisibilityChange = 0 +# anglesLUT.EnableOpacityMapping = 1 +# anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] +# anglesLUT.UseLogScale = 0 +# anglesLUT.ColorSpace = 'Diverging' +# anglesLUT.UseBelowRangeColor = 0 +# anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] +# anglesLUT.UseAboveRangeColor = 0 +# anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] +# anglesLUT.NanColor = [1.0, 1.0, 0.0] +# anglesLUT.NanOpacity = 1.0 +# anglesLUT.Discretize = 1 +# anglesLUT.NumberOfTableValues = 256 +# anglesLUT.ScalarRangeInitialized = 1.0 +# anglesLUT.HSVWrap = 0 +# anglesLUT.VectorComponent = 0 +# anglesLUT.VectorMode = 'Magnitude' +# anglesLUT.AllowDuplicateScalars = 1 +# anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] +# anglesLUT.ActiveAnnotatedValues = [] +# anglesLUT.IndexedColors = [1.0, 0.10196078431372549, 0.023529411764705882, 0.03137254901960784, 0.03137254901960784, 1.0] +# anglesLUT.IndexedOpacities = [1.0, 0.015] +# +# # Properties modified on anglesLUT +# anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] +# anglesLUT.IndexedColors = [1.0, 0.10196078431372549, 0.023529411764705882, 1.0, 0.10196078431372549, 0.023529411764705882] +# anglesLUT.IndexedOpacities = [1.0, -1.0] +# +# # get opacity transfer function/opacity map for 'angles' +# anglesPWF = GetOpacityTransferFunction('angles') +# anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] +# anglesPWF.AllowDuplicateScalars = 1 +# anglesPWF.UseLogScale = 0 +# anglesPWF.ScalarRangeInitialized = 1 +# +# # Properties modified on anglesLUT +# anglesLUT.IndexedColors = [1.0, 0.10196078431372549, 0.023529411764705882, 0.07450980392156863, 0.043137254901960784, 1.0] +# +# # Properties modified on anglesLUT +# anglesLUT.IndexedOpacities = [1.0, 0.01] +# +# # get active source. +# transform1 = GetActiveSource() +# +# # get active view +# renderView1 = GetActiveViewOrCreate('RenderView') +# # uncomment following to set a specific view size +# # renderView1.ViewSize = [1257, 934] +# +# # get display properties +# transform1Display = GetDisplayProperties(transform1, view=renderView1) +# +# # Properties modified on transform1Display +# transform1Display.Opacity = 0.2 +# +# transform1Display.GaussianRadius = 0.02 +# +# # Properties modified on anglesLUT +# anglesLUT.IndexedOpacities = [1.0, 0.017] +# elseif case == 2: +# + + +# +if gamma == '0': + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + anglesLUT.InterpretValuesAsCategories = 0 + anglesLUT.AnnotationsInitialized = 0 + anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 + anglesLUT.RescaleOnVisibilityChange = 0 + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + anglesLUT.UseLogScale = 0 + anglesLUT.ColorSpace = 'Diverging' + anglesLUT.UseBelowRangeColor = 0 + anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] + anglesLUT.UseAboveRangeColor = 0 + anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] + anglesLUT.NanColor = [1.0, 1.0, 0.0] + anglesLUT.NanOpacity = 1.0 + anglesLUT.Discretize = 1 + anglesLUT.NumberOfTableValues = 256 + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.HSVWrap = 0 + anglesLUT.VectorComponent = 0 + anglesLUT.VectorMode = 'Magnitude' + anglesLUT.AllowDuplicateScalars = 1 + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.ActiveAnnotatedValues = [] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0, 1.0] + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + anglesPWF.AllowDuplicateScalars = 1 + anglesPWF.UseLogScale = 0 + anglesPWF.ScalarRangeInitialized = 1 + + # Properties modified on anglesLUT + anglesLUT.InterpretValuesAsCategories = 1 + anglesLUT.AnnotationsInitialized = 1 + + # Properties modified on anglesLUT + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0', '1.5707963267948966', '1.5708'] + + # Properties modified on anglesLUT + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + + # Properties modified on anglesLUT + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0] + + # Properties modified on anglesLUT + anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + + # Properties modified on anglesLUT + anglesLUT.IndexedColors = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + # Properties modified on anglesLUT + anglesLUT.IndexedColors = [1.0, 0.0, 0.0, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + # Properties modified on anglesLUT + anglesLUT.IndexedColors = [0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + + # Properties modified on anglesLUT + anglesLUT.IndexedOpacities = [1.0, 0.02] + + # Properties modified on anglesLUT + anglesLUT.IndexedOpacities = [1.0, 0.05] + + # Properties modified on anglesLUT + anglesLUT.IndexedOpacities = [1.0, 0.1] + + + + # NEW: + anglesLUT.IndexedOpacities = [0.1, 1.0] + + # Properties modified on anglesLUT + anglesLUT.IndexedColors = [0.8313725490196079, 0.0196078431372549, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # Properties modified on anglesLUT + anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + + + # if hide_redcolor: + # + # # get active source. + # transform1 = GetActiveSource() + # + # # get active view + # renderView1 = GetActiveViewOrCreate('RenderView') + # # uncomment following to set a specific view size + # # renderView1.ViewSize = [1257, 934] + # + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.InterpretValuesAsCategories = 1 + # anglesLUT.AnnotationsInitialized = 1 + # anglesLUT.EnableOpacityMapping = 1 + # anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] + # anglesLUT.ActiveAnnotatedValues = ['0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + # anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + # anglesPWF.ScalarRangeInitialized = 1 + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedOpacities = [0.0, 1.0, 1.0, 1.0] + + + # # ----------------- LEGEND ----------------- + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.InterpretValuesAsCategories = 1 + anglesLUT.AnnotationsInitialized = 1 + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] + anglesLUT.ActiveAnnotatedValues = ['0'] + anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882] + anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + + # Properties modified on anglesLUT + anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0'] + anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725] + anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0] + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # Properties modified on anglesLUT + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$'] + anglesLUT.IndexedColors = [0.8313725490196079, 0.0] + anglesLUT.IndexedOpacities = [0.1, 1.0] + + # get active source. + # transform1 = GetActiveSource() + # + # # get active view + # renderView1 = GetActiveViewOrCreate('RenderView') + # # uncomment following to set a specific view size + # # renderView1.ViewSize = [1257, 934] + # + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedOpacities = [0.0, 1.0] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [0.8196078431372549, 0.8313725490196079, 0.8274509803921568, 0.12549019607843137, 0.0, 0.3803921568627451] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 0.12549019607843137, 0.0, 0.3803921568627451] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [0.0, 0.0, 0.0, 0.12549019607843137, 0.0, 0.3803921568627451] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 0.12549019607843137, 0.0, 0.3803921568627451] + + if hide_redcolor: + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.InterpretValuesAsCategories = 1 + anglesLUT.AnnotationsInitialized = 1 + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] + anglesLUT.ActiveAnnotatedValues = ['0'] + anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.8313725490196079, 0.0, 0.0392156862745098] + anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + + # Properties modified on anglesLUT + anglesLUT.InterpretValuesAsCategories = 0 + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Preset', True) + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesPWF.ApplyPreset('Preset', True) + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.05882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.08088235557079315, 0.5, 0.0] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.2052651084495876, 1.0, 0.00392156862745098, 0.0196078431372549, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9757314324378967, 1.0, 0.9607843137254902, 0.996078431372549, 1.2052651084495876, 1.0, 0.00392156862745098, 0.0196078431372549, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.05147058889269829, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.022058824077248573, 0.5, 0.0] + + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.075, 0.5, 0.0] + + + +#### uncomment the following to render all views + + + + # ## ------------------------- + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + # anglesLUT.InterpretValuesAsCategories = 1 + # anglesLUT.AnnotationsInitialized = 1 + # anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 + # anglesLUT.RescaleOnVisibilityChange = 0 + # anglesLUT.EnableOpacityMapping = 1 + # anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + # anglesLUT.UseLogScale = 0 + # anglesLUT.ColorSpace = 'Diverging' + # anglesLUT.UseBelowRangeColor = 0 + # anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] + # anglesLUT.UseAboveRangeColor = 0 + # anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] + # anglesLUT.NanColor = [1.0, 1.0, 0.0] + # anglesLUT.NanOpacity = 1.0 + # anglesLUT.Discretize = 1 + # anglesLUT.NumberOfTableValues = 256 + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.HSVWrap = 0 + # anglesLUT.VectorComponent = 0 + # anglesLUT.VectorMode = 'Magnitude' + # anglesLUT.AllowDuplicateScalars = 1 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0', '0', '0', '1.5707963267948966', '1.5708'] + # anglesLUT.ActiveAnnotatedValues = ['0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0, 1.0] + # + # # Properties modified on anglesLUT + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.IndexedOpacities = [0.1, 1.0, 1.0] + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 0.136764707416296, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 1.0, 0.5, 0.0] + # anglesPWF.AllowDuplicateScalars = 1 + # anglesPWF.UseLogScale = 0 + # anglesPWF.ScalarRangeInitialized = 1 + # + # # Properties modified on anglesLUT + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0', '0'] + # anglesLUT.IndexedColors = [0.8313725490196079, 0.0, 0.0392156862745098, 0.12549019607843137, 0.0, 0.3803921568627451] + # anglesLUT.IndexedOpacities = [0.1, 1.0] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 0.12549019607843137, 0.0, 0.3803921568627451] + # + # # Properties modified on anglesLUT + # anglesLUT.IndexedOpacities = [0.0, 1.0] + # + # # get active source. + # transform1 = GetActiveSource() + # + # # get active view + # renderView1 = GetActiveViewOrCreate('RenderView') + # # uncomment following to set a specific view size + # # renderView1.ViewSize = [1257, 934] + # + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesPWF.ApplyPreset('Preset 6', True) + + + if hide_legend: + # get display properties + transform1Display = GetDisplayProperties(transform1, view=renderView1) + + # hide color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, False) + + + + # #TEST: (only for 100SP..) + # anglesLUT.IndexedOpacities = [1.0, 0.03] + # transform1Display.Opacity = 0.1 #overall Opacity + + +if gamma == 'infinity': #TEST + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.9632241725921631, 0.865, 0.865, 0.865, 1.5707963267948966, 1.0, 0.0, 0.0] + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.11764705926179886, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesLUT.ApplyPreset('jet', True) + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesLUT.ApplyPreset('jet', True) + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesLUT.ApplyPreset('jet', True) + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # anglesLUT.ApplyPreset('jet', True) + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 0.5625, 0.17453275066650778, 0.0, 0.0, 1.0, 0.5734655375881175, 0.0, 1.0, 1.0, 0.7729315383498405, 0.5, 1.0, 0.5, 0.9723975391115637, 1.0, 1.0, 0.0, 1.3713303260331735, 1.0, 0.0, 0.0, 1.5707963267948966, 0.6588235294117647, 0.0, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.15441176295280457, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.11764705926179886, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.08088235557079315, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.11029411852359772, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.13235294818878174, 0.5, 0.0] + + + + ###-- ALTERNATIVE WARM TO COOL : + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Warm to Cool (Extended)', True) + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.13235294818878174, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Warm to Cool (Extended)', True) + + #TEST + # anglesLUT.ApplyPreset('jet', True) + + # invert the transfer function + anglesLUT.InvertTransferFunction() + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4922565104551517, 0.470588, 0.0156863, 0.0901961, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.34902, 0.0, 0.129412] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.34902, 0.0, 0.129412] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.531279444694519, 0.396078431372549, 0.00392156862745098, 0.10196078431372549, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.34902, 0.0, 0.129412] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.5016417503356934, 0.396078431372549, 0.00392156862745098, 0.10196078431372549, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.34902, 0.0, 0.129412] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.5016417503356934, 0.396078431372549, 0.00392156862745098, 0.10196078431372549, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.6352941176470588, 0.00392156862745098, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.5315264186250241, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.6352941176470588, 0.00392156862745098, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.5115209817886353, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.6352941176470588, 0.00392156862745098, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.6352941176470588, 0.00392156862745098, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8117647058823529, 0.0, 0.027450980392156862] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.7490196078431373, 0.0, 0.03529411764705882] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.6784313725490196, 0.0, 0.03137254901960784] + + # invert the transfer function + anglesLUT.InvertTransferFunction() + + # invert the transfer function + anglesLUT.InvertTransferFunction() + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.08088235557079315, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.11764705926179886, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.15441176295280457, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.13235294818878174, 0.5, 0.0] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.125, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.08088235557079315, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.05882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.08088235557079315, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0882352963089943, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.09558823704719543, 0.5, 0.0] + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] + + + if hide_redcolor: + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + anglesLUT.ColorSpace = 'Lab' + anglesLUT.NanColor = [0.250004, 0.0, 0.0] + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesLUT.ApplyPreset('Preset', True) + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.10294117778539658, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + anglesPWF.ApplyPreset('Preset', True) + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.996078431372549, 0.9921568627450981, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 0.9888578653335571, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + # Properties modified on anglesLUT + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + + + + + ### + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.EnableOpacityMapping = 1 + anglesLUT.RGBPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.0, 0.785929, 0.247056, 0.295477, 0.0, 0.17254901960784313, 0.043137254901960784, 0.9215686274509803, 0.266739073084488, 0.41568627450980394, 0.00392156862745098, 0.9686274509803922, 0.4198669450521392, 0.48627450980392156, 0.0, 0.9725490196078431, 0.7755188552446091, 1.0, 0.058823529411764705, 0.984313725490196, 1.0413635969161987, 1.0, 0.0392156862745098, 0.47058823529411764, 1.2052651084495876, 1.0, 0.0196078431372549, 0.14901960784313725, 1.5707963267948966, 1.0, 0.0, 0.01568627450980392] + anglesLUT.NanColor = [0.250004, 0.0, 0.0] + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.Annotations = ['1.57', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + + # get opacity transfer function/opacity map for 'angles' + anglesPWF = GetOpacityTransferFunction('angles') + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.07352941483259201, 0.5, 0.0] + anglesPWF.ScalarRangeInitialized = 1 + + # Properties modified on anglesPWF + anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.036764707416296005, 0.5, 0.0] + + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.4445649345539659, 1.0, 0.5, 0.0, 0.7310624366906182, 1.0, 0.5, 0.0, 0.9879222016222671, 1.0, 0.5, 0.0, 1.254661087453241, 0.9926470518112183, 0.5, 0.0, 1.5707963267948966, 0.03, 0.5, 0.0] + + #### uncomment the following to render all views + #### uncomment the following to render all views + +#### uncomment the following to render all views + ## ------------------------------------------ + # # get display properties + # transform1Display = GetDisplayProperties(transform1, view=renderView1) + # + # # Properties modified on transform1Display + # transform1Display.Opacity = 1.0 + # + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.ColorSpace = 'Lab' + # anglesLUT.NanColor = [0.250004, 0.0, 0.0] + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + # anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.4117647111415863, 0.5, 0.0] + # anglesPWF.ScalarRangeInitialized = 1 + # + # # Properties modified on anglesLUT + # anglesLUT.EnableOpacityMapping = 1 + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.41911765933036804, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.375, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.3602941334247589, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.14705882966518402, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.125, 0.5, 0.0] + # + # # Properties modified on anglesPWF + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] + # + # #### saving camera placements for all active views + # # get color transfer function/color map for 'angles' + # anglesLUT = GetColorTransferFunction('angles') + # anglesLUT.EnableOpacityMapping = 1 + # anglesLUT.RGBPoints = [0.0, 0.12549, 0.0, 0.380392, 0.03926990816987245, 0.113725, 0.0235294, 0.45098, 0.0785398163397449, 0.105882, 0.0509804, 0.509804, 0.11780972450961717, 0.0392157, 0.0392157, 0.560784, 0.15707963267948963, 0.0313725, 0.0980392, 0.6, 0.19634954084936207, 0.0431373, 0.164706, 0.639216, 0.2356194490192345, 0.054902, 0.243137, 0.678431, 0.27488935718910695, 0.054902, 0.317647, 0.709804, 0.31415926535897926, 0.0509804, 0.396078, 0.741176, 0.35342917352885167, 0.0392157, 0.466667, 0.768627, 0.39269908169872414, 0.0313725, 0.537255, 0.788235, 0.450920647551377, 0.0313725, 0.615686, 0.811765, 0.5001541168221094, 0.0235294, 0.709804, 0.831373, 0.5470439579732639, 0.0509804, 0.8, 0.85098, 0.581428689566804, 0.0705882, 0.854902, 0.870588, 0.618940876646993, 0.262745, 0.901961, 0.862745, 0.6478560954306335, 0.423529, 0.941176, 0.87451, 0.6845860259400787, 0.572549, 0.964706, 0.835294, 0.7119383023785582, 0.658824, 0.980392, 0.843137, 0.7361646941267158, 0.764706, 0.980392, 0.866667, 0.7596088293041297, 0.827451, 0.980392, 0.886275, 0.7838273670706534, 0.913725, 0.988235, 0.937255, 0.7853981633974483, 1.0, 1.0, 1.0, 0.7869689597242432, 0.988235, 0.980392, 0.870588, 0.8111874974907669, 0.992157, 0.964706, 0.713725, 0.8322880045486029, 0.988235, 0.956863, 0.643137, 0.8729260763191136, 0.980392, 0.917647, 0.509804, 0.9127818915188803, 0.968627, 0.87451, 0.407843, 0.9495118220283256, 0.94902, 0.823529, 0.321569, 0.9817477042468103, 0.929412, 0.776471, 0.278431, 1.0210176124166828, 0.909804, 0.717647, 0.235294, 1.0602875205865552, 0.890196, 0.658824, 0.196078, 1.0995574287564276, 0.878431, 0.619608, 0.168627, 1.1388273369263, 0.870588, 0.54902, 0.156863, 1.1780972450961724, 0.85098, 0.47451, 0.145098, 1.2173671532660448, 0.831373, 0.411765, 0.133333, 1.2566370614359172, 0.811765, 0.345098, 0.113725, 1.2959069696057897, 0.788235, 0.266667, 0.0941176, 1.335176877775662, 0.741176, 0.184314, 0.0745098, 1.3744467859455345, 0.690196, 0.12549, 0.0627451, 1.413716694115407, 0.619608, 0.0627451, 0.0431373, 1.4571852684020996, 0.4, 0.00392157, 0.101961, 1.5707963267948966, 0.8313725490196079, 0.0, 0.0392156862745098] + # anglesLUT.ColorSpace = 'Lab' + # anglesLUT.NanColor = [0.250004, 0.0, 0.0] + # anglesLUT.ScalarRangeInitialized = 1.0 + # anglesLUT.Annotations = ['1.5707963267948966', '$\\pi / 2$', '0.78', '$\\pi/4$', '0', '0'] + # anglesLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + # anglesLUT.IndexedOpacities = [1.0, 1.0, 1.0] + # + # # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + # # anglesLUT.ApplyPreset('jet', True) + # + # + # # get opacity transfer function/opacity map for 'angles' + # anglesPWF = GetOpacityTransferFunction('angles') + # anglesPWF.Points = [0.0, 1.0, 0.5, 0.0, 0.705621357414266, 1.0, 0.5, 0.0, 0.82168139570297, 1.0, 0.5, 0.0, 0.9799451305746117, 1.0, 0.5, 0.0, 1.0960051688633157, 1.0, 0.5, 0.0, 1.5707963267948966, 0.0, 0.5, 0.0] + # anglesPWF.ScalarRangeInitialized = 1 + + +if curvature == 1: + # set scalar coloring + ColorBy(transform1Display, ('POINTS', 'curvature')) + + # get color transfer function/color map for 'angles' + anglesLUT = GetColorTransferFunction('angles') + anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + anglesLUT.InterpretValuesAsCategories = 0 + anglesLUT.AnnotationsInitialized = 0 + anglesLUT.ShowCategoricalColorsinDataRangeOnly = 0 + anglesLUT.RescaleOnVisibilityChange = 0 + anglesLUT.EnableOpacityMapping = 0 + anglesLUT.RGBPoints = [0.0, 0.23137254902, 0.298039215686, 0.752941176471, 0.7853981633974483, 0.865, 0.865, 0.865, 1.5707963267948966, 0.705882352941, 0.0156862745098, 0.149019607843] + anglesLUT.UseLogScale = 0 + anglesLUT.ColorSpace = 'Diverging' + anglesLUT.UseBelowRangeColor = 0 + anglesLUT.BelowRangeColor = [0.0, 0.0, 0.0] + anglesLUT.UseAboveRangeColor = 0 + anglesLUT.AboveRangeColor = [0.5, 0.5, 0.5] + anglesLUT.NanColor = [1.0, 1.0, 0.0] + anglesLUT.NanOpacity = 1.0 + anglesLUT.Discretize = 1 + anglesLUT.NumberOfTableValues = 256 + anglesLUT.ScalarRangeInitialized = 1.0 + anglesLUT.HSVWrap = 0 + anglesLUT.VectorComponent = 0 + anglesLUT.VectorMode = 'Magnitude' + anglesLUT.AllowDuplicateScalars = 1 + anglesLUT.Annotations = [] + anglesLUT.ActiveAnnotatedValues = [] + anglesLUT.IndexedColors = [] + anglesLUT.IndexedOpacities = [] + + # Hide the scalar bar for this color map if no visible data is colored by it. + HideScalarBarIfNotNeeded(anglesLUT, renderView1) + + # rescale color and/or opacity maps used to include current data range + transform1Display.RescaleTransferFunctionToDataRange(True, False) + + # show color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, True) + + # get color transfer function/color map for 'curvature' + curvatureLUT = GetColorTransferFunction('curvature') + curvatureLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + curvatureLUT.InterpretValuesAsCategories = 0 + curvatureLUT.AnnotationsInitialized = 0 + curvatureLUT.ShowCategoricalColorsinDataRangeOnly = 0 + curvatureLUT.RescaleOnVisibilityChange = 0 + curvatureLUT.EnableOpacityMapping = 0 + curvatureLUT.RGBPoints = [-1187.69685, 0.001462, 0.000466, 0.013866, -1178.375848332, 0.002258, 0.001295, 0.018331, -1169.057223258, 0.003279, 0.002305, 0.023708, -1159.73622159, 0.004512, 0.00349, 0.029965, -1150.4175965159998, 0.00595, 0.004843, 0.03713, -1141.0965948479998, 0.007588, 0.006356, 0.044973, -1131.7779697740002, 0.009426, 0.008022, 0.052844, -1122.4569681060002, 0.011465, 0.009828, 0.06075, -1113.1359664379997, 0.013708, 0.011771, 0.068667, -1103.8173413640002, 0.016156, 0.01384, 0.076603, -1094.4963396960002, 0.018815, 0.016026, 0.084584, -1085.1777146220002, 0.021692, 0.01832, 0.09261, -1075.8567129540002, 0.024792, 0.020715, 0.100676, -1066.53808788, 0.028123, 0.023201, 0.108787, -1057.2170862120001, 0.031696, 0.025765, 0.116965, -1047.8960845440001, 0.03552, 0.028397, 0.125209, -1038.57745947, 0.039608, 0.03109, 0.133515, -1029.2564578019999, 0.04383, 0.03383, 0.141886, -1019.9378327279999, 0.048062, 0.036607, 0.150327, -1010.6168310599999, 0.05232, 0.039407, 0.158841, -1001.2982059860002, 0.056615, 0.04216, 0.167446, -991.9772043180003, 0.060949, 0.044794, 0.176129, -982.6562026499998, 0.06533, 0.047318, 0.184892, -973.3375775760002, 0.069764, 0.049726, 0.193735, -964.0165759080003, 0.074257, 0.052017, 0.20266, -954.697950834, 0.078815, 0.054184, 0.211667, -945.3769491660001, 0.083446, 0.056225, 0.220755, -936.058324092, 0.088155, 0.058133, 0.229922, -926.737322424, 0.092949, 0.059904, 0.239164, -917.4186973499998, 0.097833, 0.061531, 0.248477, -908.0976956819999, 0.102815, 0.06301, 0.257854, -898.776694014, 0.107899, 0.064335, 0.267289, -889.4580689399997, 0.113094, 0.065492, 0.276784, -880.1370672719999, 0.118405, 0.066479, 0.286321, -870.8184421980002, 0.123833, 0.067295, 0.295879, -861.4974405300002, 0.12938, 0.067935, 0.305443, -852.1788154560002, 0.135053, 0.068391, 0.315, -842.8578137880002, 0.140858, 0.068654, 0.324538, -833.5368121200001, 0.146785, 0.068738, 0.334011, -824.218187046, 0.152839, 0.068637, 0.343404, -814.8971853780001, 0.159018, 0.068354, 0.352688, -805.5785603039999, 0.165308, 0.067911, 0.361816, -796.257558636, 0.171713, 0.067305, 0.370771, -786.9389335619999, 0.178212, 0.066576, 0.379497, -777.6179318939999, 0.184801, 0.065732, 0.387973, -768.2969302259999, 0.19146, 0.064818, 0.396152, -758.9783051520003, 0.198177, 0.063862, 0.404009, -749.6573034839998, 0.204935, 0.062907, 0.411514, -740.3386784100002, 0.211718, 0.061992, 0.418647, -731.0176767420003, 0.218512, 0.061158, 0.425392, -721.699051668, 0.225302, 0.060445, 0.431742, -712.3780500000001, 0.232077, 0.059889, 0.437695, -703.0570483320002, 0.238826, 0.059517, 0.443256, -693.738423258, 0.245543, 0.059352, 0.448436, -684.41742159, 0.25222, 0.059415, 0.453248, -675.0987965159999, 0.258857, 0.059706, 0.45771, -665.777794848, 0.265447, 0.060237, 0.46184, -656.4591697739999, 0.271994, 0.060994, 0.46566, -647.1381681059999, 0.278493, 0.061978, 0.46919, -637.817166438, 0.284951, 0.063168, 0.472451, -628.4985413639997, 0.291366, 0.064553, 0.475462, -619.1775396959998, 0.29774, 0.066117, 0.478243, -609.8589146220002, 0.304081, 0.067835, 0.480812, -600.5379129540003, 0.310382, 0.069702, 0.483186, -591.21928788, 0.316654, 0.07169, 0.48538, -581.8982862120001, 0.322899, 0.073782, 0.487408, -572.5772845440001, 0.329114, 0.075972, 0.489287, -563.25865947, 0.335308, 0.078236, 0.491024, -553.9376578020001, 0.341482, 0.080564, 0.492631, -544.6190327279999, 0.347636, 0.082946, 0.494121, -535.29803106, 0.353773, 0.085373, 0.495501, -525.9794059860003, 0.359898, 0.087831, 0.496778, -516.6584043179998, 0.366012, 0.090314, 0.49796, -507.33740264999994, 0.372116, 0.092816, 0.499053, -498.0187775760003, 0.378211, 0.095332, 0.500067, -488.6977759079998, 0.384299, 0.097855, 0.501002, -479.37915083400014, 0.390384, 0.100379, 0.501864, -470.05814916600025, 0.396467, 0.102902, 0.502658, -460.739524092, 0.402548, 0.10542, 0.503386, -451.4185224240001, 0.408629, 0.10793, 0.504052, -442.09989735, 0.414709, 0.110431, 0.504662, -432.778895682, 0.420791, 0.11292, 0.505215, -423.4578940140001, 0.426877, 0.115395, 0.505714, -414.13926893999985, 0.432967, 0.117855, 0.50616, -404.81826727199996, 0.439062, 0.120298, 0.506555, -395.49964219799983, 0.445163, 0.122724, 0.506901, -386.1786405299998, 0.451271, 0.125132, 0.507198, -376.86001545600016, 0.457386, 0.127522, 0.507448, -367.5390137879997, 0.463508, 0.129893, 0.507652, -358.21801212000025, 0.46964, 0.132245, 0.507809, -348.89938704600013, 0.47578, 0.134577, 0.507921, -339.57838537800023, 0.481929, 0.136891, 0.507989, -330.259760304, 0.488088, 0.139186, 0.508011, -320.9387586360001, 0.494258, 0.141462, 0.507988, -311.620133562, 0.500438, 0.143719, 0.50792, -302.29913189399997, 0.506629, 0.145958, 0.507806, -292.9781302260001, 0.512831, 0.148179, 0.507648, -283.65950515199984, 0.519045, 0.150383, 0.507443, -274.33850348399994, 0.52527, 0.152569, 0.507192, -265.0198784100003, 0.531507, 0.154739, 0.506895, -255.6988767419998, 0.537755, 0.156894, 0.506551, -246.38025166800014, 0.544015, 0.159033, 0.506159, -237.05925000000025, 0.550287, 0.161158, 0.505719, -227.73824833199978, 0.556571, 0.163269, 0.50523, -218.41962325800012, 0.562866, 0.165368, 0.504692, -209.09862159000022, 0.569172, 0.167454, 0.504105, -199.77999651599998, 0.57549, 0.16953, 0.503466, -190.4589948480001, 0.581819, 0.171596, 0.502777, -181.14036977399996, 0.588158, 0.173652, 0.502035, -171.81936810599996, 0.594508, 0.175701, 0.501241, -162.49836643799995, 0.600868, 0.177743, 0.500394, -153.17974136399994, 0.607238, 0.179779, 0.499492, -143.85873969599993, 0.613617, 0.181811, 0.498536, -134.5401146219997, 0.620005, 0.18384, 0.497524, -125.21911295400037, 0.626401, 0.185867, 0.496456, -115.90048788000013, 0.632805, 0.187893, 0.495332, -106.57948621200012, 0.639216, 0.189921, 0.49415, -97.25848454400034, 0.645633, 0.191952, 0.49291, -87.9398594700001, 0.652056, 0.193986, 0.491611, -78.6188578020001, 0.658483, 0.196027, 0.490253, -69.30023272800008, 0.664915, 0.198075, 0.488836, -59.979231060000075, 0.671349, 0.200133, 0.487358, -50.66060598599984, 0.677786, 0.202203, 0.485819, -41.33960431799983, 0.684224, 0.204286, 0.484219, -32.01860265000005, 0.690661, 0.206384, 0.482558, -22.69997757599981, 0.697098, 0.208501, 0.480835, -13.378975907999802, 0.703532, 0.210638, 0.479049, -4.060350834000246, 0.709962, 0.212797, 0.477201, 5.2606508340002165, 0.716387, 0.214982, 0.47529, 14.579275908000454, 0.722805, 0.217194, 0.473316, 23.90027757599978, 0.729216, 0.219437, 0.471279, 33.21890265000002, 0.735616, 0.221713, 0.46918, 42.5399043179998, 0.742004, 0.224025, 0.467018, 51.86090598599981, 0.748378, 0.226377, 0.464794, 61.179531060000045, 0.754737, 0.228772, 0.462509, 70.50053272800005, 0.761077, 0.231214, 0.460162, 79.81915780199961, 0.767398, 0.233705, 0.457755, 89.14015947000007, 0.773695, 0.236249, 0.455289, 98.45878454400031, 0.779968, 0.238851, 0.452765, 107.77978621199964, 0.786212, 0.241514, 0.450184, 117.1007878800001, 0.792427, 0.244242, 0.447543, 126.41941295400034, 0.798608, 0.24704, 0.444848, 135.74041462199966, 0.804752, 0.249911, 0.442102, 145.0590396959999, 0.810855, 0.252861, 0.439305, 154.38004136400036, 0.816914, 0.255895, 0.436461, 163.69866643799992, 0.822926, 0.259016, 0.433573, 173.01966810599993, 0.828886, 0.262229, 0.430644, 182.34066977399993, 0.834791, 0.26554, 0.427671, 191.65929484799994, 0.840636, 0.268953, 0.424666, 200.98029651599995, 0.846416, 0.272473, 0.421631, 210.2989215900002, 0.852126, 0.276106, 0.418573, 219.6199232580002, 0.857763, 0.279857, 0.415496, 228.93854833199975, 0.86332, 0.283729, 0.412403, 238.25955000000022, 0.868793, 0.287728, 0.409303, 247.58055166799954, 0.874176, 0.291859, 0.406205, 256.8991767419998, 0.879464, 0.296125, 0.403118, 266.22017841000024, 0.884651, 0.30053, 0.400047, 275.5388034839998, 0.889731, 0.305079, 0.397002, 284.8598051519998, 0.8947, 0.309773, 0.393995, 294.17843022600005, 0.899552, 0.314616, 0.391037, 303.49943189400005, 0.904281, 0.31961, 0.388137, 312.82043356199983, 0.908884, 0.324755, 0.385308, 322.1390586360001, 0.913354, 0.330052, 0.382563, 331.4600603040001, 0.917689, 0.3355, 0.379915, 340.77868537799964, 0.921884, 0.341098, 0.377376, 350.0996870460001, 0.925937, 0.346844, 0.374959, 359.41831212000034, 0.929845, 0.352734, 0.372677, 368.73931378799966, 0.933606, 0.358764, 0.370541, 378.0603154560001, 0.937221, 0.364929, 0.368567, 387.37894053000036, 0.940687, 0.371224, 0.366762, 396.6999421979997, 0.944006, 0.377643, 0.365136, 406.0185672719999, 0.94718, 0.384178, 0.363701, 415.3395689400004, 0.95021, 0.39082, 0.362468, 424.65819401399995, 0.953099, 0.397563, 0.361438, 433.97919568199995, 0.955849, 0.4044, 0.360619, 443.30019734999996, 0.958464, 0.411324, 0.360014, 452.618822424, 0.960949, 0.418323, 0.35963, 461.939824092, 0.96331, 0.42539, 0.359469, 471.2584491660002, 0.965549, 0.432519, 0.359529, 480.57945083399954, 0.967671, 0.439703, 0.35981, 489.8980759079998, 0.96968, 0.446936, 0.360311, 499.21907757600025, 0.971582, 0.45421, 0.36103, 508.5377026500005, 0.973381, 0.46152, 0.361965, 517.8587043179998, 0.975082, 0.468861, 0.363111, 527.1797059860003, 0.97669, 0.476226, 0.364466, 536.4983310599998, 0.97821, 0.483612, 0.366025, 545.8193327279998, 0.979645, 0.491014, 0.367783, 555.1379578020001, 0.981, 0.498428, 0.369734, 564.4589594700001, 0.982279, 0.505851, 0.371874, 573.7775845439996, 0.983485, 0.51328, 0.374198, 583.0985862120001, 0.984622, 0.520713, 0.376698, 592.4195878800001, 0.985693, 0.528148, 0.379371, 601.7382129539997, 0.9867, 0.535582, 0.38221, 611.0592146220001, 0.987646, 0.543015, 0.38521, 620.3778396960004, 0.988533, 0.550446, 0.388365, 629.6988413639997, 0.989363, 0.557873, 0.391671, 639.0174664379999, 0.990138, 0.565296, 0.395122, 648.3384681060004, 0.990871, 0.572706, 0.398714, 657.6594697739997, 0.991558, 0.580107, 0.402441, 666.978094848, 0.992196, 0.587502, 0.406299, 676.299096516, 0.992785, 0.594891, 0.410283, 685.61772159, 0.993326, 0.602275, 0.41439, 694.938723258, 0.993834, 0.609644, 0.418613, 704.2573483320002, 0.994309, 0.616999, 0.42295, 713.57835, 0.994738, 0.62435, 0.427397, 722.899351668, 0.995122, 0.631696, 0.431951, 732.2179767420002, 0.99548, 0.639027, 0.436607, 741.5389784099996, 0.99581, 0.646344, 0.441361, 750.8576034839998, 0.996096, 0.653659, 0.446213, 760.1786051520003, 0.996341, 0.660969, 0.45116, 769.4972302259998, 0.99658, 0.668256, 0.456192, 778.8182318939998, 0.996775, 0.675541, 0.461314, 788.1392335620003, 0.996925, 0.682828, 0.466526, 797.4578586359999, 0.997077, 0.690088, 0.471811, 806.7788603039999, 0.997186, 0.697349, 0.477182, 816.0974853780001, 0.997254, 0.704611, 0.482635, 825.4184870460001, 0.997325, 0.711848, 0.488154, 834.7371121199997, 0.997351, 0.719089, 0.493755, 844.0581137880001, 0.997351, 0.726324, 0.499428, 853.3791154560001, 0.997341, 0.733545, 0.505167, 862.6977405299997, 0.997285, 0.740772, 0.510983, 872.0187421980002, 0.997228, 0.747981, 0.516859, 881.3373672720002, 0.997138, 0.75519, 0.522806, 890.6583689399997, 0.997019, 0.762398, 0.528821, 899.9769940139997, 0.996898, 0.769591, 0.534892, 909.2979956820002, 0.996727, 0.776795, 0.541039, 918.6189973499997, 0.996571, 0.783977, 0.547233, 927.9376224239998, 0.996369, 0.791167, 0.553499, 937.2586240919998, 0.996162, 0.798348, 0.55982, 946.5772491660002, 0.995932, 0.805527, 0.566202, 955.8982508340002, 0.99568, 0.812706, 0.572645, 965.2168759080002, 0.995424, 0.819875, 0.57914, 974.5378775759998, 0.995131, 0.827052, 0.585701, 983.8565026499998, 0.994851, 0.834213, 0.592307, 993.1775043180003, 0.994524, 0.841387, 0.598983, 1002.4985059859998, 0.994222, 0.84854, 0.605696, 1011.8171310599998, 0.993866, 0.855711, 0.612482, 1021.1381327280003, 0.993545, 0.862859, 0.619299, 1030.4567578019999, 0.99317, 0.870024, 0.626189, 1039.7777594699999, 0.992831, 0.877168, 0.633109, 1049.0963845439999, 0.99244, 0.88433, 0.640099, 1058.4173862119999, 0.992089, 0.89147, 0.647116, 1067.73838788, 0.991688, 0.898627, 0.654202, 1077.057012954, 0.991332, 0.905763, 0.661309, 1086.378014622, 0.99093, 0.912915, 0.668481, 1095.6966396959995, 0.99057, 0.920049, 0.675675, 1105.0176413640004, 0.990175, 0.927196, 0.682926, 1114.3362664380004, 0.989815, 0.934329, 0.690198, 1123.657268106, 0.989434, 0.94147, 0.697519, 1132.9782697740004, 0.989077, 0.948604, 0.704863, 1142.2968948480004, 0.988717, 0.955742, 0.712242, 1151.617896516, 0.988367, 0.962878, 0.719649, 1160.93652159, 0.988033, 0.970012, 0.727077, 1170.257523258, 0.987691, 0.977154, 0.734536, 1179.576148332, 0.987387, 0.984288, 0.742002, 1188.89715, 0.987053, 0.991438, 0.749504] + curvatureLUT.UseLogScale = 0 + curvatureLUT.ColorSpace = 'RGB' + curvatureLUT.UseBelowRangeColor = 0 + curvatureLUT.BelowRangeColor = [0.0, 0.0, 0.0] + curvatureLUT.UseAboveRangeColor = 0 + curvatureLUT.AboveRangeColor = [0.5, 0.5, 0.5] + curvatureLUT.NanColor = [0.0, 1.0, 0.0] + curvatureLUT.NanOpacity = 1.0 + curvatureLUT.Discretize = 1 + curvatureLUT.NumberOfTableValues = 256 + curvatureLUT.ScalarRangeInitialized = 1.0 + curvatureLUT.HSVWrap = 0 + curvatureLUT.VectorComponent = 0 + curvatureLUT.VectorMode = 'Magnitude' + curvatureLUT.AllowDuplicateScalars = 1 + curvatureLUT.Annotations = [] + curvatureLUT.ActiveAnnotatedValues = [] + curvatureLUT.IndexedColors = [] + curvatureLUT.IndexedOpacities = [] + + # get opacity transfer function/opacity map for 'curvature' + curvaturePWF = GetOpacityTransferFunction('curvature') + curvaturePWF.Points = [-1187.69685, 0.8602941036224365, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + curvaturePWF.AllowDuplicateScalars = 1 + curvaturePWF.UseLogScale = 0 + curvaturePWF.ScalarRangeInitialized = 1 + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + curvatureLUT.ApplyPreset('Cold and Hot', True) + + + + #NEW: + + # set active source + SetActiveSource(transform1) + + # get color transfer function/color map for 'curvature' + curvatureLUT = GetColorTransferFunction('curvature') + curvatureLUT.RGBPoints = [-1187.69685, 0.0, 1.0, 1.0, -118.22955000000002, 0.0, 0.0, 1.0, 0.6001499999999851, 0.0, 0.0, 0.501960784314, 119.42984999999999, 1.0, 0.0, 0.0, 1188.89715, 1.0, 1.0, 0.0] + curvatureLUT.ColorSpace = 'RGB' + curvatureLUT.ScalarRangeInitialized = 1.0 + + # get opacity transfer function/opacity map for 'curvature' + curvaturePWF = GetOpacityTransferFunction('curvature') + curvaturePWF.Points = [-1187.69685, 0.8602941036224365, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + curvaturePWF.ScalarRangeInitialized = 1 + + # Properties modified on curvatureLUT + curvatureLUT.EnableOpacityMapping = 1 + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.6911764740943909, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.6691176295280457, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.6617646813392639, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.6323529481887817, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5073529481887817, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.47058823704719543, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.4779411852359772, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.4852941334247589, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -328.2367841697693, 0.6691176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -231.0803985595703, 0.5441176295280457, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -246.02752685546875, 0.5588235259056091, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -253.5010986328125, 0.5588235259056091, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -679.4943625218383, 0.625, 0.5, 0.0, -253.5010986328125, 0.5661764740943909, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # Properties modified on curvaturePWF + curvaturePWF.Points = [-1187.69685, 0.5, 0.5, 0.0, -694.4414672851562, 0.5147058963775635, 0.5, 0.0, -253.5010986328125, 0.5661764740943909, 0.5, 0.0, 396.61992227722794, 0.8676470518112183, 0.5, 0.0, 561.1175226475239, 0.6911764740943909, 0.5, 0.0, 1188.89715, 0.8014705777168274, 0.5, 0.0] + + # create a new 'Contour' + contour1 = Contour(Input=transform1) + contour1.ContourBy = ['POINTS', 'Type'] + contour1.Isosurfaces = [2.0] + contour1.PointMergeMethod = 'Uniform Binning' + + # Properties modified on contour1 + contour1.ContourBy = ['POINTS', 'curvature'] + contour1.Isosurfaces = [0.0] + + # show data in view + contour1Display = Show(contour1, renderView1) + + # trace defaults for the display properties. + contour1Display.Representation = 'Surface' + contour1Display.ColorArrayName = ['POINTS', 'curvature'] + contour1Display.LookupTable = curvatureLUT + contour1Display.OSPRayScaleArray = 'curvature' + contour1Display.OSPRayScaleFunction = 'PiecewiseFunction' + contour1Display.SelectOrientationVectors = 'None' + contour1Display.ScaleFactor = 0.09752500000000001 + contour1Display.SelectScaleArray = 'curvature' + contour1Display.GlyphType = 'Arrow' + contour1Display.GlyphTableIndexArray = 'curvature' + contour1Display.GaussianRadius = 0.00487625 + contour1Display.SetScaleArray = ['POINTS', 'curvature'] + contour1Display.ScaleTransferFunction = 'PiecewiseFunction' + contour1Display.OpacityArray = ['POINTS', 'curvature'] + contour1Display.OpacityTransferFunction = 'PiecewiseFunction' + contour1Display.DataAxesGrid = 'GridAxesRepresentation' + contour1Display.PolarAxes = 'PolarAxesRepresentation' + + # init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction' + contour1Display.OSPRayScaleFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.213836476688135, 0.625, 0.5, 0.0, 1.3616352081298828, 0.6691176295280457, 0.5, 0.0, 1.6666333299996667, 0.8676470518112183, 0.5, 0.0, 1.7358490228652954, 0.6911764740943909, 0.5, 0.0, 2.0, 0.8014705777168274, 0.5, 0.0] + + # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' + contour1Display.ScaleTransferFunction.Points = [0.0, 0.8602941036224365, 0.5, 0.0, 2.5142493840581125e-39, 0.625, 0.5, 0.0, 4.252039284300157e-39, 0.6691176295280457, 0.5, 0.0, 7.838150278676329e-39, 0.8676470518112183, 0.5, 0.0, 8.651975477491057e-39, 0.6911764740943909, 0.5, 0.0, 1.1757813367477812e-38, 0.8014705777168274, 0.5, 0.0] + + # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' + contour1Display.OpacityTransferFunction.Points = [0.0, 0.8602941036224365, 0.5, 0.0, 2.5142493840581125e-39, 0.625, 0.5, 0.0, 4.252039284300157e-39, 0.6691176295280457, 0.5, 0.0, 7.838150278676329e-39, 0.8676470518112183, 0.5, 0.0, 8.651975477491057e-39, 0.6911764740943909, 0.5, 0.0, 1.1757813367477812e-38, 0.8014705777168274, 0.5, 0.0] + + # show color bar/color legend + contour1Display.SetScalarBarVisibility(renderView1, True) + + # find source + xMLStructuredGridReader1 = FindSource('XMLStructuredGridReader1') + + # update the view to ensure updated data information + renderView1.Update() + + # set scalar coloring using an separate color/opacity maps + ColorBy(contour1Display, ('POINTS', 'curvature'), True) + + # Hide the scalar bar for this color map if no visible data is colored by it. + HideScalarBarIfNotNeeded(curvatureLUT, renderView1) + + # rescale color and/or opacity maps used to include current data range + contour1Display.RescaleTransferFunctionToDataRange(True, False) + + # show color bar/color legend + contour1Display.SetScalarBarVisibility(renderView1, True) + + # get separate color transfer function/color map for 'curvature' + separate_contour1Display_curvatureLUT = GetColorTransferFunction('curvature', contour1Display, separate=True) + separate_contour1Display_curvatureLUT.RGBPoints = [0.0, 0.001462, 0.000466, 0.013866, 4.611414402724776e-41, 0.002258, 0.001295, 0.018331, 9.2216530241129e-41, 0.003279, 0.002305, 0.023708, 1.3833067426837675e-40, 0.004512, 0.00349, 0.029965, 1.84433060482258e-40, 0.00595, 0.004843, 0.03713, 2.3054720450950578e-40, 0.007588, 0.006356, 0.044973, 2.766495907233844e-40, 0.009426, 0.008022, 0.052844, 3.2276373475063216e-40, 0.011465, 0.009828, 0.06075, 3.688778787778825e-40, 0.013708, 0.011771, 0.068667, 4.1498026499176114e-40, 0.016156, 0.01384, 0.076603, 4.6109440901900895e-40, 0.018815, 0.016026, 0.084584, 5.071967952328902e-40, 0.021692, 0.01832, 0.09261, 5.533109392601379e-40, 0.024792, 0.020715, 0.100676, 5.994133254740192e-40, 0.028123, 0.023201, 0.108787, 6.455274695012669e-40, 0.031696, 0.025765, 0.116965, 6.9164161352851465e-40, 0.03552, 0.028397, 0.125209, 7.37743999742396e-40, 0.039608, 0.03109, 0.133515, 7.838581437696437e-40, 0.04383, 0.03383, 0.141886, 8.299605299835249e-40, 0.048062, 0.036607, 0.150327, 8.760746740107726e-40, 0.05232, 0.039407, 0.158841, 9.221770602246514e-40, 0.056615, 0.04216, 0.167446, 9.682912042518991e-40, 0.060949, 0.044794, 0.176129, 1.0144053482791495e-39, 0.06533, 0.047318, 0.184892, 1.060507734493028e-39, 0.069764, 0.049726, 0.193735, 1.1066218785202758e-39, 0.074257, 0.052017, 0.20266, 1.152724264734157e-39, 0.078815, 0.054184, 0.211667, 1.1988384087614049e-39, 0.083446, 0.056225, 0.220755, 1.2449407949752861e-39, 0.088155, 0.058133, 0.229922, 1.2910549390025338e-39, 0.092949, 0.059904, 0.239164, 1.337157325216415e-39, 0.097833, 0.061531, 0.248477, 1.3832714692436628e-39, 0.102815, 0.06301, 0.257854, 1.4293856132709107e-39, 0.107899, 0.064335, 0.267289, 1.475487999484792e-39, 0.113094, 0.065492, 0.276784, 1.5216021435120396e-39, 0.118405, 0.066479, 0.286321, 1.5677045297259182e-39, 0.123833, 0.067295, 0.295879, 1.613818673753166e-39, 0.12938, 0.067935, 0.305443, 1.6599210599670472e-39, 0.135053, 0.068391, 0.315, 1.706035203994295e-39, 0.140858, 0.068654, 0.324538, 1.7521493480215426e-39, 0.146785, 0.068738, 0.334011, 1.7982517342354242e-39, 0.152839, 0.068637, 0.343404, 1.844365878262672e-39, 0.159018, 0.068354, 0.352688, 1.890468264476553e-39, 0.165308, 0.067911, 0.361816, 1.936582408503801e-39, 0.171713, 0.067305, 0.370771, 1.982684794717682e-39, 0.178212, 0.066576, 0.379497, 2.0287989387449298e-39, 0.184801, 0.065732, 0.387973, 2.0749130827721775e-39, 0.19146, 0.064818, 0.396152, 2.121015468986056e-39, 0.198177, 0.063862, 0.404009, 2.1671296130133065e-39, 0.204935, 0.062907, 0.411514, 2.213231999227185e-39, 0.211718, 0.061992, 0.418647, 2.2593461432544328e-39, 0.218512, 0.061158, 0.425392, 2.305448529468314e-39, 0.225302, 0.060445, 0.431742, 2.351562673495562e-39, 0.232077, 0.059889, 0.437695, 2.3976768175228098e-39, 0.238826, 0.059517, 0.443256, 2.443779203736691e-39, 0.245543, 0.059352, 0.448436, 2.4898933477639387e-39, 0.25222, 0.059415, 0.453248, 2.53599573397782e-39, 0.258857, 0.059706, 0.45771, 2.5821098780050677e-39, 0.265447, 0.060237, 0.46184, 2.628212264218949e-39, 0.271994, 0.060994, 0.46566, 2.6743264082461966e-39, 0.278493, 0.061978, 0.46919, 2.7204405522734444e-39, 0.284951, 0.063168, 0.472451, 2.7665429384873256e-39, 0.291366, 0.064553, 0.475462, 2.8126570825145736e-39, 0.29774, 0.066117, 0.478243, 2.8587594687284522e-39, 0.304081, 0.067835, 0.480812, 2.9048736127557e-39, 0.310382, 0.069702, 0.483186, 2.950975998969581e-39, 0.316654, 0.07169, 0.48538, 2.9970901429968286e-39, 0.322899, 0.073782, 0.487408, 3.0432042870240766e-39, 0.329114, 0.075972, 0.489287, 3.089306673237958e-39, 0.335308, 0.078236, 0.491024, 3.135420817265206e-39, 0.341482, 0.080564, 0.492631, 3.181523203479087e-39, 0.347636, 0.082946, 0.494121, 3.2276373475063345e-39, 0.353773, 0.085373, 0.495501, 3.273739733720213e-39, 0.359898, 0.087831, 0.496778, 3.319853877747464e-39, 0.366012, 0.090314, 0.49796, 3.365968021774711e-39, 0.372116, 0.092816, 0.499053, 3.41207040798859e-39, 0.378211, 0.095332, 0.500067, 3.4581845520158405e-39, 0.384299, 0.097855, 0.501002, 3.504286938229719e-39, 0.390384, 0.100379, 0.501864, 3.5504010822569665e-39, 0.396467, 0.102902, 0.502658, 3.5965034684708484e-39, 0.402548, 0.10542, 0.503386, 3.642617612498096e-39, 0.408629, 0.10793, 0.504052, 3.688719998711977e-39, 0.414709, 0.110431, 0.504662, 3.734834142739225e-39, 0.420791, 0.11292, 0.505215, 3.7809482867664724e-39, 0.426877, 0.115395, 0.505714, 3.8270506729803536e-39, 0.432967, 0.117855, 0.50616, 3.873164817007602e-39, 0.439062, 0.120298, 0.506555, 3.919267203221483e-39, 0.445163, 0.122724, 0.506901, 3.96538134724873e-39, 0.451271, 0.125132, 0.507198, 4.011483733462609e-39, 0.457386, 0.127522, 0.507448, 4.0575978774898596e-39, 0.463508, 0.129893, 0.507652, 4.103712021517105e-39, 0.46964, 0.132245, 0.507809, 4.149814407730986e-39, 0.47578, 0.134577, 0.507921, 4.1959285517582336e-39, 0.481929, 0.136891, 0.507989, 4.242030937972115e-39, 0.488088, 0.139186, 0.508011, 4.288145081999363e-39, 0.494258, 0.141462, 0.507988, 4.334247468213244e-39, 0.500438, 0.143719, 0.50792, 4.3803616122404915e-39, 0.506629, 0.145958, 0.507806, 4.4264757562677396e-39, 0.512831, 0.148179, 0.507648, 4.472578142481621e-39, 0.519045, 0.150383, 0.507443, 4.518692286508868e-39, 0.52527, 0.152569, 0.507192, 4.564794672722747e-39, 0.531507, 0.154739, 0.506895, 4.6109088167499975e-39, 0.537755, 0.156894, 0.506551, 4.657011202963876e-39, 0.544015, 0.159033, 0.506159, 4.703125346991124e-39, 0.550287, 0.161158, 0.505719, 4.749239491018374e-39, 0.556571, 0.163269, 0.50523, 4.795341877232253e-39, 0.562866, 0.165368, 0.504692, 4.841456021259501e-39, 0.569172, 0.167454, 0.504105, 4.887558407473382e-39, 0.57549, 0.16953, 0.503466, 4.9336725515006294e-39, 0.581819, 0.171596, 0.502777, 4.9797749377145106e-39, 0.588158, 0.173652, 0.502035, 5.025889081741759e-39, 0.594508, 0.175701, 0.501241, 5.072003225769006e-39, 0.600868, 0.177743, 0.500394, 5.118105611982888e-39, 0.607238, 0.179779, 0.499492, 5.1642197560101354e-39, 0.613617, 0.181811, 0.498536, 5.2103221422240166e-39, 0.620005, 0.18384, 0.497524, 5.256436286251262e-39, 0.626401, 0.185867, 0.496456, 5.302538672465143e-39, 0.632805, 0.187893, 0.495332, 5.3486528164923907e-39, 0.639216, 0.189921, 0.49415, 5.394766960519639e-39, 0.645633, 0.191952, 0.49291, 5.44086934673352e-39, 0.652056, 0.193986, 0.491611, 5.486983490760767e-39, 0.658483, 0.196027, 0.490253, 5.5330858769746485e-39, 0.664915, 0.198075, 0.488836, 5.5792000210018966e-39, 0.671349, 0.200133, 0.487358, 5.625302407215778e-39, 0.677786, 0.202203, 0.485819, 5.671416551243026e-39, 0.684224, 0.204286, 0.484219, 5.717530695270273e-39, 0.690661, 0.206384, 0.482558, 5.7636330814841545e-39, 0.697098, 0.208501, 0.480835, 5.8097472255114025e-39, 0.703532, 0.210638, 0.479049, 5.855849611725281e-39, 0.709962, 0.212797, 0.477201, 5.901963755752531e-39, 0.716387, 0.214982, 0.47529, 5.948066141966412e-39, 0.722805, 0.217194, 0.473316, 5.994180285993657e-39, 0.729216, 0.219437, 0.471279, 6.040282672207538e-39, 0.735616, 0.221713, 0.46918, 6.086396816234787e-39, 0.742004, 0.224025, 0.467018, 6.132510960262034e-39, 0.748378, 0.226377, 0.464794, 6.178613346475916e-39, 0.754737, 0.228772, 0.462509, 6.224727490503163e-39, 0.761077, 0.231214, 0.460162, 6.270829876717042e-39, 0.767398, 0.233705, 0.457755, 6.316944020744293e-39, 0.773695, 0.236249, 0.455289, 6.363046406958174e-39, 0.779968, 0.238851, 0.452765, 6.409160550985419e-39, 0.786212, 0.241514, 0.450184, 6.455274695012669e-39, 0.792427, 0.244242, 0.447543, 6.50137708122655e-39, 0.798608, 0.24704, 0.444848, 6.547491225253795e-39, 0.804752, 0.249911, 0.442102, 6.593593611467676e-39, 0.810855, 0.252861, 0.439305, 6.639707755494928e-39, 0.816914, 0.255895, 0.436461, 6.685810141708806e-39, 0.822926, 0.259016, 0.433573, 6.731924285736054e-39, 0.828886, 0.262229, 0.430644, 6.778038429763301e-39, 0.834791, 0.26554, 0.427671, 6.824140815977182e-39, 0.840636, 0.268953, 0.424666, 6.870254960004431e-39, 0.846416, 0.272473, 0.421631, 6.916357346218312e-39, 0.852126, 0.276106, 0.418573, 6.96247149024556e-39, 0.857763, 0.279857, 0.415496, 7.008573876459438e-39, 0.86332, 0.283729, 0.412403, 7.054688020486688e-39, 0.868793, 0.287728, 0.409303, 7.100802164513933e-39, 0.874176, 0.291859, 0.406205, 7.146904550727814e-39, 0.879464, 0.296125, 0.403118, 7.193018694755065e-39, 0.884651, 0.30053, 0.400047, 7.239121080968944e-39, 0.889731, 0.305079, 0.397002, 7.285235224996191e-39, 0.8947, 0.309773, 0.393995, 7.331337611210073e-39, 0.899552, 0.314616, 0.391037, 7.37745175523732e-39, 0.904281, 0.31961, 0.388137, 7.423565899264569e-39, 0.908884, 0.324755, 0.385308, 7.46966828547845e-39, 0.913354, 0.330052, 0.382563, 7.515782429505697e-39, 0.917689, 0.3355, 0.379915, 7.561884815719576e-39, 0.921884, 0.341098, 0.377376, 7.607998959746826e-39, 0.925937, 0.346844, 0.374959, 7.654101345960707e-39, 0.929845, 0.352734, 0.372677, 7.700215489987953e-39, 0.933606, 0.358764, 0.370541, 7.746329634015203e-39, 0.937221, 0.364929, 0.368567, 7.792432020229085e-39, 0.940687, 0.371224, 0.366762, 7.83854616425633e-39, 0.944006, 0.377643, 0.365136, 7.88464855047021e-39, 0.94718, 0.384178, 0.363701, 7.93076269449746e-39, 0.95021, 0.39082, 0.362468, 7.976865080711339e-39, 0.953099, 0.397563, 0.361438, 8.022979224738588e-39, 0.955849, 0.4044, 0.360619, 8.069093368765835e-39, 0.958464, 0.411324, 0.360014, 8.115195754979717e-39, 0.960949, 0.418323, 0.35963, 8.161309899006964e-39, 0.96331, 0.42539, 0.359469, 8.207412285220845e-39, 0.965549, 0.432519, 0.359529, 8.253526429248091e-39, 0.967671, 0.439703, 0.35981, 8.299628815461972e-39, 0.96968, 0.446936, 0.360311, 8.345742959489222e-39, 0.971582, 0.45421, 0.36103, 8.391845345703104e-39, 0.973381, 0.46152, 0.361965, 8.437959489730349e-39, 0.975082, 0.468861, 0.363111, 8.484073633757599e-39, 0.97669, 0.476226, 0.364466, 8.530176019971477e-39, 0.97821, 0.483612, 0.366025, 8.576290163998726e-39, 0.979645, 0.491014, 0.367783, 8.622392550212607e-39, 0.981, 0.498428, 0.369734, 8.668506694239854e-39, 0.982279, 0.505851, 0.371874, 8.714609080453733e-39, 0.983485, 0.51328, 0.374198, 8.760723224480983e-39, 0.984622, 0.520713, 0.376698, 8.806837368508232e-39, 0.985693, 0.528148, 0.379371, 8.85293975472211e-39, 0.9867, 0.535582, 0.38221, 8.89905389874936e-39, 0.987646, 0.543015, 0.38521, 8.945156284963242e-39, 0.988533, 0.550446, 0.388365, 8.991270428990486e-39, 0.989363, 0.557873, 0.391671, 9.037372815204368e-39, 0.990138, 0.565296, 0.395122, 9.083486959231618e-39, 0.990871, 0.572706, 0.398714, 9.129601103258864e-39, 0.991558, 0.580107, 0.402441, 9.175703489472745e-39, 0.992196, 0.587502, 0.406299, 9.221817633499992e-39, 0.992785, 0.594891, 0.410283, 9.267920019713874e-39, 0.993326, 0.602275, 0.41439, 9.314034163741121e-39, 0.993834, 0.609644, 0.418613, 9.360136549955002e-39, 0.994309, 0.616999, 0.42295, 9.406250693982251e-39, 0.994738, 0.62435, 0.427397, 9.452364838009498e-39, 0.995122, 0.631696, 0.431951, 9.49846722422338e-39, 0.99548, 0.639027, 0.436607, 9.544581368250624e-39, 0.99581, 0.646344, 0.441361, 9.590683754464506e-39, 0.996096, 0.653659, 0.446213, 9.636797898491756e-39, 0.996341, 0.660969, 0.45116, 9.682900284705634e-39, 0.99658, 0.668256, 0.456192, 9.729014428732883e-39, 0.996775, 0.675541, 0.461314, 9.775128572760133e-39, 0.996925, 0.682828, 0.466526, 9.821230958974011e-39, 0.997077, 0.690088, 0.471811, 9.867345103001259e-39, 0.997186, 0.697349, 0.477182, 9.91344748921514e-39, 0.997254, 0.704611, 0.482635, 9.959561633242389e-39, 0.997325, 0.711848, 0.488154, 1.0005664019456267e-38, 0.997351, 0.719089, 0.493755, 1.0051778163483517e-38, 0.997351, 0.726324, 0.499428, 1.0097892307510765e-38, 0.997341, 0.733545, 0.505167, 1.0143994693724643e-38, 0.997285, 0.740772, 0.510983, 1.0190108837751893e-38, 0.997228, 0.747981, 0.516859, 1.0236211223965776e-38, 0.997138, 0.75519, 0.522806, 1.0282325367993021e-38, 0.997019, 0.762398, 0.528821, 1.0328427754206902e-38, 0.996898, 0.769591, 0.534892, 1.0374541898234152e-38, 0.996727, 0.776795, 0.541039, 1.0420656042261397e-38, 0.996571, 0.783977, 0.547233, 1.0466758428475278e-38, 0.996369, 0.791167, 0.553499, 1.0512872572502527e-38, 0.996162, 0.798348, 0.55982, 1.0558974958716408e-38, 0.995932, 0.805527, 0.566202, 1.0605089102743655e-38, 0.99568, 0.812706, 0.572645, 1.0651191488957537e-38, 0.995424, 0.819875, 0.57914, 1.0697305632984781e-38, 0.995131, 0.827052, 0.585701, 1.0743408019198663e-38, 0.994851, 0.834213, 0.592307, 1.0789522163225914e-38, 0.994524, 0.841387, 0.598983, 1.0835636307253159e-38, 0.994222, 0.84854, 0.605696, 1.088173869346704e-38, 0.993866, 0.855711, 0.612482, 1.092785283749429e-38, 0.993545, 0.862859, 0.619299, 1.0973955223708168e-38, 0.99317, 0.870024, 0.626189, 1.1020069367735416e-38, 0.992831, 0.877168, 0.633109, 1.1066171753949297e-38, 0.99244, 0.88433, 0.640099, 1.1112285897976546e-38, 0.992089, 0.89147, 0.647116, 1.1158400042003793e-38, 0.991688, 0.898627, 0.654202, 1.1204502428217674e-38, 0.991332, 0.905763, 0.661309, 1.1250616572244922e-38, 0.99093, 0.912915, 0.668481, 1.12967189584588e-38, 0.99057, 0.920049, 0.675675, 1.1342833102486052e-38, 0.990175, 0.927196, 0.682926, 1.1388935488699933e-38, 0.989815, 0.934329, 0.690198, 1.1435049632727178e-38, 0.989434, 0.94147, 0.697519, 1.1481163776754428e-38, 0.989077, 0.948604, 0.704863, 1.1527266162968309e-38, 0.988717, 0.955742, 0.712242, 1.1573380306995554e-38, 0.988367, 0.962878, 0.719649, 1.1619482693209435e-38, 0.988033, 0.970012, 0.727077, 1.1665596837236684e-38, 0.987691, 0.977154, 0.734536, 1.1711699223450565e-38, 0.987387, 0.984288, 0.742002, 1.1757813367477812e-38, 0.987053, 0.991438, 0.749504] + separate_contour1Display_curvatureLUT.ColorSpace = 'RGB' + separate_contour1Display_curvatureLUT.NanColor = [0.0, 1.0, 0.0] + separate_contour1Display_curvatureLUT.ScalarRangeInitialized = 1.0 + + # get separate opacity transfer function/opacity map for 'curvature' + separate_contour1Display_curvaturePWF = GetOpacityTransferFunction('curvature', contour1Display, separate=True) + separate_contour1Display_curvaturePWF.Points = [0.0, 0.8602941036224365, 0.5, 0.0, 2.5142493840581125e-39, 0.625, 0.5, 0.0, 4.252039284300157e-39, 0.6691176295280457, 0.5, 0.0, 7.838150278676329e-39, 0.8676470518112183, 0.5, 0.0, 8.651975477491057e-39, 0.6911764740943909, 0.5, 0.0, 1.1757813367477812e-38, 0.8014705777168274, 0.5, 0.0] + separate_contour1Display_curvaturePWF.ScalarRangeInitialized = 1 + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + separate_contour1Display_curvatureLUT.ApplyPreset('X Ray', True) + + # hide color bar/color legend + contour1Display.SetScalarBarVisibility(renderView1, False) + + # hide data in view + # Hide(line1, renderView1) + + + + # get color legend/bar for curvatureLUT in view renderView1 + curvatureLUTColorBar = GetScalarBar(curvatureLUT, renderView1) + curvatureLUTColorBar.Title = 'curvature' + curvatureLUTColorBar.ComponentTitle = '' + + # Properties modified on curvatureLUTColorBar + curvatureLUTColorBar.Title = '$ \\kappa $' + curvatureLUTColorBar.HorizontalTitle = 1 + curvatureLUTColorBar.TitleFontSize = 24 + curvatureLUTColorBar.LabelFontSize = 20 + + transform1Display.Opacity = 0.01 #overall Opacity + + # get display properties + transform1Display = GetDisplayProperties(transform1, view=renderView1) + + # rescale color and/or opacity maps used to exactly fit the current data range + transform1Display.RescaleTransferFunctionToDataRange(False, True) + + + + + + + + + + + + + + + +# update the view to ensure updated data information +renderView1.Update() + + +# ----------------- EXPORT ----------------- +# save screenshot +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[1257, 934]) +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[2514, 1868]) +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[1063, 657]) + +if gamma == '0' : + # SaveScreenshot('/home/klaus/Desktop/3DPhaseDiagramPlot_Gamma0.png', renderView1, ImageResolution=[2126, 1314]) + SaveScreenshot('/home/klaus/Desktop/3DPhaseDiagramPlot_Gamma0.png', renderView1, ImageResolution=[2126, 1314],OverrideColorPalette='WhiteBackground') + +elif gamma == 'infinity': + # SaveScreenshot('/home/klaus/Desktop/3DPhaseDiagramPlot_GammaInf.png', renderView1, ImageResolution=[2126, 1314]) + SaveScreenshot('/home/klaus/Desktop/3DPhaseDiagramPlot_GammaInf.png', renderView1, ImageResolution=[2126, 1314],OverrideColorPalette='WhiteBackground') +# export view +# ExportView('/home/klaus/Desktop/PhaseDiagramPlot.pdf', view=renderView1) diff --git a/src/PhaseDiagram_PlotScript_BetaSmallerOne.py b/src/PhaseDiagram_PlotScript_BetaSmallerOne.py index 01f93eb18728f634274114ab6d037be04f31716b..ef746bf66aed7756b8b03f72a6c4a89a5b05680d 100644 --- a/src/PhaseDiagram_PlotScript_BetaSmallerOne.py +++ b/src/PhaseDiagram_PlotScript_BetaSmallerOne.py @@ -15,7 +15,7 @@ paraview.simple._DisableFirstRenderCameraReset() case = 1 case = 2 # -contour = 0 +contour = 1 # create a new 'XML Structured Grid Reader' diff --git a/src/Plot-1-ParameterFamily.py b/src/Plot-1-ParameterFamily.py index 173f2c6f47dad29aaa0a29c877068b344c3b54c1..efc223cf27c7beddde6da6eec816f4d35a391480 100644 --- a/src/Plot-1-ParameterFamily.py +++ b/src/Plot-1-ParameterFamily.py @@ -127,7 +127,8 @@ kappas = [] alphas = [] # G.append(float(s[0])) - +G_container = [] +abar_container = [] for t in T : @@ -136,27 +137,48 @@ for t in T : # print('abar_current', abar_current) abar_current[abar_current < 1e-10] = 0 # print('abar_current', abar_current) - # G = np.array([[2*q1, q12+2*q3], [q12+2*q3,2*q2] ]) G = [abar_current[0], abar_current[1] , (2*abar_current[0]*abar_current[1])**0.5 ] - + G_container.append(G) + abar_container.append(abar_current) e = [(abar_current[0]/(abar_current[0]+abar_current[1]))**0.5, (abar_current[1]/(abar_current[0]+abar_current[1]))**0.5] kappa = abar_current[0]+abar_current[1] alpha = math.atan2(e[1], e[0]) - print('angle current:', alpha) - kappas.append(kappa) alphas.append(alpha) + +# idx_1 = np.where(alphas == np.pi/4) +idx_1 = np.where(np.round(alphas,3) == round(np.pi/3,3)) +idx_2 = np.where(np.round(alphas,3) == 0.0) +idx_3 = np.where(np.round(alphas,3) == round(np.pi/4,3)) + +# idx_3 = np.where(alphas == 0) + +print('Index idx_1:', idx_1) +print('Index idx_2:', idx_2) +print('Index idx_3:', idx_3) +print('Index idx_1[0][0]:', idx_1[0][0]) +print('Index idx_2[0][0]:', idx_2[0][0]) +print('Index idx_3[0][0]:', idx_3[0][0]) + alphas = np.array(alphas) kappas = np.array(kappas) +print('alphas[idx_1[0][0]]', alphas[idx_1[0][0]]) +print('kappas[idx_1[0][0]]', kappas[idx_1[0][0]]) +print('alphas[idx_2[0][0]]', alphas[idx_2[0][0]]) +print('kappas[idx_2[0][0]]', kappas[idx_2[0][0]]) +print('alphas[idx_3[0][0]]', alphas[idx_3[0][0]]) +print('kappas[idx_3[0][0]]', kappas[idx_3[0][0]]) + -print('kappas:',kappas) -print('alphas:',alphas) + +# print('kappas:',kappas) +# print('alphas:',alphas) print('min alpha:', min(alphas)) print('min kappa:', min(kappas)) @@ -186,9 +208,24 @@ ax.plot(alphas, kappas, 'royalblue', zorder=3, ) ax.plot(-1.0*alphas, kappas, 'red', zorder=3, ) +ax.scatter(-1*alphas[idx_1[0][0]],kappas[idx_1[0][0]], marker='x', color='black',zorder=5, s=40) +ax.scatter(alphas[idx_2[0][0]],kappas[idx_2[0][0]], marker='x', color='black' ,zorder=5, s=40) +ax.scatter(alphas[idx_3[0][0]],kappas[idx_3[0][0]], marker='x', color='black', zorder=5, s=40) + +label = [r'$\mathcal S^+_{Q,B}$', '$T\mathcal S^+_{Q,B}$'] + + +# ax.annotate(label, xy=np.array([[np.pi/4,0.55],[np.pi/4,0.55]])) + + + +ax.annotate(r'$\mathcal S^+_{Q,B}$', np.array([np.pi/4,0.55]), color= 'royalblue', size=12) +ax.annotate(r'$T\mathcal S^+_{Q,B}$', np.array([-np.pi/4-0.55,0.55]), color= 'red', size=12) + +# -ax.set_xlabel(r"angle $\alpha$") -ax.set_ylabel(r"curvature $\kappa$") +ax.set_xlabel(r"angle $\alpha$" ,fontsize=10, labelpad=0) +ax.set_ylabel(r"curvature $\kappa$", fontsize=10, labelpad=0) diff --git a/src/Plot-Angle-Alpha_intermediateGamma.py b/src/Plot-Angle-Alpha_intermediateGamma.py index c070ed4c1678b30a95547ae37cade0a85cfd2c42..fa69e157f32dcd0e75060e008f8040961678ed3a 100644 --- a/src/Plot-Angle-Alpha_intermediateGamma.py +++ b/src/Plot-Angle-Alpha_intermediateGamma.py @@ -195,8 +195,8 @@ gamma = 0.75 # gamma = 3.0 Gamma_Values = [0.5, 0.75, 1.5, 3.0] -Gamma_Values = [ 1.5, 3.0] -# Gamma_Values = [3.0] +# Gamma_Values = [ 1.5, 3.0] +Gamma_Values = [3.0] # Gamma_Values = ['infinity'] print('(Input) Gamma_Values:', Gamma_Values) # # @@ -230,6 +230,7 @@ for gamma in Gamma_Values: numPoints = 2000 numPoints = 300 + numPoints = 30 X_Values = np.linspace(xmin, xmax, num=numPoints) print(X_Values) @@ -476,7 +477,11 @@ for gamma in Gamma_Values: # ax = plt.axes((0.15,0.18,0.6,0.6)) # ax = plt.axes((0.15,0.2,0.75,0.75)) # ax = plt.axes((0.18,0.2,0.75,0.75)) - ax = plt.axes((0.28,0.3,0.65,0.65)) + + + # ax = plt.axes((0.28,0.3,0.65,0.65)) # This one! + + ax = plt.axes((0.25,0.25,0.6,0.6)) # ax = plt.axes((0.1,0.1,0.5,0.8)) # ax = plt.axes((0.1,0.1,1,1)) # ax = plt.axes() @@ -587,8 +592,12 @@ for gamma in Gamma_Values: # --- leave out jumps: # ax.scatter(X_Values, Y_Values) - ax.set_xlabel(r"prestrain ratio $\theta_\rho$") - ax.set_ylabel(r"angle $\alpha$") + # ax.set_xlabel(r"prestrain ratio $\theta_\rho$",labelpad=0) + ax.set_xlabel(r"$\theta_\rho$",labelpad=0) + ax.set_ylabel(r"$\alpha$") + # ax.set_ylabel(r"angle $\alpha$") + + ax.set_title(r"$\gamma = \ $"+str(gamma), fontsize=10) if Jumps: @@ -782,6 +791,7 @@ for gamma in Gamma_Values: # l3 = ax.scatter(X_Values,Angle_Theta025,color='orangered', s=2 ,zorder=3, label=r"$\theta = 0.25$") # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") l5 = ax.scatter(X_Values,Angle_Theta05, color='royalblue', s=0.15 ,zorder=3, label=r"$\theta = 0.5$") + # l5 = ax.scatter(X_Values,Angle_Theta05, color='royalblue' ,zorder=3, label=r"$\theta = 0.5$") # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") # l7 = ax.scatter(X_Values,Angle_Theta075, s=2, zorder=3, label=r"$\theta = 0.75$") # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") @@ -818,6 +828,8 @@ for gamma in Gamma_Values: labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] ax.set_yticklabels(labels) + + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], # loc='upper left', diff --git a/src/Plot-Angle-GammaV2_SubPlots.py b/src/Plot-Angle-GammaV2_SubPlots.py index 35ba8cf1540ff290cd244ab2065bbf89093ecd4e..f0513528ba657dda70c811b61d685426454df93e 100644 --- a/src/Plot-Angle-GammaV2_SubPlots.py +++ b/src/Plot-Angle-GammaV2_SubPlots.py @@ -143,12 +143,18 @@ alpha_1 = -1.0 alpha_2 = -0.75 alpha_3 = -0.70 +# alpha_1 = -1 +# alpha_2 = -0.5 +# alpha_3 = -0.25 + angles_1 = [] angles_2 = [] angles_3 = [] beta = 2.0 theta= 0.25 +# beta = 10.0 +# theta= 0.5 @@ -168,7 +174,8 @@ print('----------------------------') gamma_min = 0.01 gamma_max = 1.5 -Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... +# Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... +Gamma_Values = np.linspace(gamma_min, gamma_max, num=40) # TODO variable Input Parameters...alpha,beta... print('(Input) Gamma_Values:', Gamma_Values) # mu_gamma = [] diff --git a/src/Plot-Curvature-Alpha_intermediateGamma.py b/src/Plot-Curvature-Alpha_intermediateGamma.py new file mode 100644 index 0000000000000000000000000000000000000000..b7e0f3e462997575646c33ab18c89dd32207e7b5 --- /dev/null +++ b/src/Plot-Curvature-Alpha_intermediateGamma.py @@ -0,0 +1,877 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# import tikzplotlib +# # from pylab import * +# from tikzplotlib import save as tikz_save + + +# Needed ? +mpl.use('pdf') + +# from subprocess import Popen, PIPE +#import sys + +###################### makePlot.py ######################### +# Generalized Plot-Script giving the option to define +# quantity of interest and the parameter it depends on +# to create a plot +# +# Input: Define y & x for "x-y plot" as Strings +# - Run the 'Cell-Problem' for the different Parameter-Points +# (alternatively run 'Compute_MuGamma' if quantity of interest +# is q3=muGamma for a significant Speedup) + +########################################################### + + + +# figsize argument takes inputs in inches +# and we have the width of our document in pts. +# To set the figure size we construct a function +# to convert from pts to inches and to determine +# an aesthetic figure height using the golden ratio: +# def set_size(width, fraction=1): +# """Set figure dimensions to avoid scaling in LaTeX. +# +# Parameters +# ---------- +# width: float +# Document textwidth or columnwidth in pts +# fraction: float, optional +# Fraction of the width which you wish the figure to occupy +# +# Returns +# ------- +# fig_dim: tuple +# Dimensions of figure in inches +# """ +# # Width of figure (in pts) +# fig_width_pt = width * fraction +# +# # Convert from pt to inches +# inches_per_pt = 1 / 72.27 +# +# # Golden ratio to set aesthetic figure height +# # https://disq.us/p/2940ij3 +# golden_ratio = (5**.5 - 1) / 2 +# +# # Figure width in inches +# fig_width_in = fig_width_pt * inches_per_pt +# # Figure height in inches +# fig_height_in = fig_width_in * golden_ratio +# +# fig_dim = (fig_width_in, fig_height_in) +# +# return fig_dim +# + + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') +mu1 = 1.0 #10.0 +# lambda1 = 10.0 +rho1 = 1.0 +# alpha = 5.0 +# beta = 10.0 +# alpha = 2.0 +# beta = 2.0 +# theta = 1.0/8.0 #1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +# TEST: +# alpha=3.0; + + + + +# # INTERESTING!: +# alpha = 3 +beta = 2.0 +# theta= 1/8 + + + + +#TEST +# beta=2 + + + +gamma = 'infinity' #Elliptic Setting +gamma = '0' #Hyperbolic Setting +# gamma = 0.01 +# # gamma= 3.0 +gamma = 0.5 +gamma = 0.75 +# # gamma = 100.0 +# gamma = 3.0 + +Gamma_Values = [0.5, 0.75, 1.5, 3.0] +# Gamma_Values = [ 1.5, 3.0] +# Gamma_Values = [3.0] +# Gamma_Values = ['infinity'] +print('(Input) Gamma_Values:', Gamma_Values) +# # +for gamma in Gamma_Values: + + print('mu1: ', mu1) + print('rho1: ', rho1) + # print('alpha: ', alpha) + print('beta: ', beta) + # print('theta: ', theta) + print('gamma:', gamma) + print('----------------------------') + + + + # --- define Interval of x-va1ues: + xmin = -2.0 + # xmax = 0.41 + xmax = 3.0 + + + xmin = -1.5 + xmax = 2.0 + + xmin = -1.0 + xmax = -0.5 + + + Jumps = False + + + numPoints = 2000 + numPoints = 300 + numPoints = 30 + numPoints = 100 + X_Values = np.linspace(xmin, xmax, num=numPoints) + print(X_Values) + + + Y_Values = [] + + + + + + Curvature_Theta01 = [] + Curvature_Theta025 = [] + Curvature_Theta05 = [] + + Curvature_Theta075 = [] + Curvature_Theta09 = [] + + + + + + + for alpha in X_Values: + print('Situation of Lemma1.4') + q12 = 0.0 + # q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) + # q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) + # b1 = prestrain_b1(rho1, beta, alpha,theta) + # b2 = prestrain_b2(rho1, beta, alpha,theta) + # b3 = 0.0 + q3_Theta01 = GetMuGamma(beta,0.1,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + q3_Theta025 = GetMuGamma(beta,0.25,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + q3_Theta05 = GetMuGamma(beta,0.5,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + q3_Theta075 = GetMuGamma(beta,0.75,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + q3_Theta09 = GetMuGamma(beta,0.9,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.1, q3_Theta01, mu1, rho1) + Curvature_Theta01.append(curvature) + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.25, q3_Theta025, mu1, rho1) + Curvature_Theta025.append(curvature) + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.5, q3_Theta05, mu1, rho1) + Curvature_Theta05.append(curvature) + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.75, q3_Theta075, mu1, rho1) + Curvature_Theta075.append(curvature) + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.9, q3_Theta09, mu1, rho1) + Curvature_Theta09.append(curvature) + + + + + # + # G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg05 .append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.25,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg025.append(angle) + # G, angle, Type, curvature = classifyMin_ana(3.0,beta,theta, q3, mu1, rho1) + # Angle_alpha3.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg075.append(angle) + # G, angle, Type, curvature = classifyMin_ana(0,beta,theta, q3, mu1, rho1) + # Angle_alpha0.append(angle) + # # G, angle, Type, curvature = classifyMin_ana(-0.125,beta,theta, q3, mu1, rho1) + # # Angle_alphaNeg0125.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0125.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(-0.625,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0625.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.875,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0875.append(angle) + + # + # + # print("(Output) Values of angle: ", Y_Values) + # + # + # idx = find_nearestIdx(Y_Values, 0) + # print(' Idx of value closest to 0', idx) + # ValueClose = Y_Values[idx] + # print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) + # + # + # + # # Find Indices where the difference between the next one is larger than epsilon... + # jump_idx = [] + # jump_xValues = [] + # jump_yValues = [] + # tmp = X_Values[0] + # for idx, x in enumerate(X_Values): + # print(idx, x) + # if idx > 0: + # if abs(Y_Values[idx]-Y_Values[idx-1]) > 1: + # print('jump candidate') + # jump_idx.append(idx) + # jump_xValues.append(x) + # jump_yValues.append(Y_Values[idx]) + # + # + # + # + # + # + # + # print("Jump Indices", jump_idx) + # print("Jump X-values:", jump_xValues) + # print("Jump Y-values:", jump_yValues) + # + # y_plotValues = [Y_Values[0]] + # x_plotValues = [X_Values[0]] + # # y_plotValues.extend(jump_yValues) + # for i in jump_idx: + # y_plotValues.extend([Y_Values[i-1], Y_Values[i]]) + # x_plotValues.extend([X_Values[i-1], X_Values[i]]) + # + # + # y_plotValues.append(Y_Values[-1]) + # # x_plotValues = [X_Values[0]] + # # x_plotValues.extend(jump_xValues) + # x_plotValues.append(X_Values[-1]) + # + # + # print("y_plotValues:", y_plotValues) + # print("x_plotValues:", x_plotValues) + + + # Y_Values[np.diff(y) >= 0.5] = np.nan + + + #get values bigger than jump position + # gamma = infty + # x_rest = X_Values[X_Values>x_plotValues[1]] + # Y_Values = np.array(Y_Values) #convert the np array + # y_rest = Y_Values[X_Values>x_plotValues[1]] + # + # + # # gamma = 0 + # x_rest = X_Values[X_Values>x_plotValues[3]] + # Y_Values = np.array(Y_Values) #convert the np array + # y_rest = Y_Values[X_Values>x_plotValues[3]] + + # gamma between + # Y_Values = np.array(Y_Values) #convert the np array + # X_Values = np.array(X_Values) #convert the np array + # + # x_one = X_Values[X_Values>x_plotValues[3]] + # # ax.scatter(X_Values, Y_Values) + # y_rest = Y_Values[X_Values>x_plotValues[3]] + # ax.plot(X_Values[X_Values>0.135], Y_Values[X_Values<0.135]) + # + # + # + + + # y_rest = Y_Values[np.nonzero(X_Values>x_plotValues[1]] + # print('X_Values:', X_Values) + # print('Y_Values:', Y_Values) + # print('x_rest:', x_rest) + # print('y_rest:', y_rest) + # print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) + + + + + # --- Convert to numpy array + Y_Values = np.array(Y_Values) + X_Values = np.array(X_Values) + + Curvature_Theta01 = np.array(Curvature_Theta01) + Curvature_Theta025 = np.array(Curvature_Theta025) + + Curvature_Theta05 = np.array(Curvature_Theta05) + + Curvature_Theta075 = np.array(Curvature_Theta075) + Curvature_Theta09 = np.array(Curvature_Theta09) + # ---------------- Create Plot ------------------- + + #--- change plot style: SEABORN + # plt.style.use("seaborn-paper") + + + #--- Adjust gobal matplotlib variables + # mpl.rcParams['pdf.fonttype'] = 42 + # mpl.rcParams['ps.fonttype'] = 42 + mpl.rcParams['text.usetex'] = True + mpl.rcParams["font.family"] = "serif" + mpl.rcParams["font.size"] = "9" + + + # plt.rc('font', family='serif', serif='Times') + # plt.rc('font', family='serif') + # # plt.rc('text', usetex=True) #also works... + # plt.rc('xtick', labelsize=8) + # plt.rc('ytick', labelsize=8) + # plt.rc('axes', labelsize=8) + + + + + + #---- Scale Figure apropriately to fit tex-File Width + # width = 452.9679 + + # width as measured in inkscape + width = 6.28 *0.5 + width = 6.28 *0.333 + # width = 6.28 + height = width / 1.618 + + #setup canvas first + fig = plt.figure() #main + # fig, ax = plt.subplots() + # fig, (ax, ax2) = plt.subplots(ncols=2) + # fig,axes = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one plot + + + # fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + + # TEST + # mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) + # fig = plt.figure(figsize=(width+0.1,height+0.1)) + + + # mpl.rcParams['figure.figsize'] = (width,height) + # fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height + # fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height + # fig = plt.figure(figsize=set_size(width)) + # fig = plt.subplots(1, 1, figsize=set_size(width)) + + # --- To create a figure half the width of your document:# + # fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + + #--- You must select the correct size of the plot in advance + # fig.set_size_inches(3.54,3.54) + + # ax = plt.axes((0.15,0.18,0.8,0.8)) + # ax = plt.axes((0.15,0.18,0.6,0.6)) + # ax = plt.axes((0.15,0.2,0.75,0.75)) + # ax = plt.axes((0.18,0.2,0.75,0.75)) + + + # ax = plt.axes((0.28,0.3,0.65,0.65)) # This one! + + ax = plt.axes((0.25,0.25,0.6,0.6)) + # ax = plt.axes((0.1,0.1,0.5,0.8)) + # ax = plt.axes((0.1,0.1,1,1)) + # ax = plt.axes() + + # ax.spines['right'].set_visible(False) + # ax.spines['left'].set_visible(False) + # ax.spines['bottom'].set_visible(False) + # ax.spines['top'].set_visible(False) + # ax.tick_params(axis='x',which='major',direction='out',length=10,width=5,color='red',pad=15,labelsize=15,labelcolor='green', + # labelrotation=15) + # ax.tick_params(axis='x',which='major', direction='out',pad=5,labelsize=10) + # ax.tick_params(axis='y',which='major', length=5, width=1, direction='out',pad=5,labelsize=10) + ax.tick_params(axis='x',which='major', direction='out',pad=3) + ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) + # ax.xaxis.set_major_locator(MultipleLocator(0.05)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.025)) + # ax.xaxis.set_major_locator(MultipleLocator(0.1)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) + ax.xaxis.set_major_locator(MultipleLocator(0.25)) + ax.xaxis.set_minor_locator(MultipleLocator(0.125)) + # ax.xaxis.set_major_locator(MultipleLocator(0.5)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.25)) + #---- print data-types + print(ax.xaxis.get_major_locator()) + print(ax.xaxis.get_minor_locator()) + print(ax.xaxis.get_major_formatter()) + print(ax.xaxis.get_minor_formatter()) + + #---- Hide Ticks or Labels + # ax.yaxis.set_major_locator(plt.NullLocator()) + # ax.xaxis.set_major_formatter(plt.NullFormatter()) + + #---- Reducing or Increasing the Number of Ticks + # ax.xaxis.set_major_locator(plt.MaxNLocator(3)) + # ax.yaxis.set_major_locator(plt.MaxNLocator(3)) + + + #----- Fancy Tick Formats + # ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) + # ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) + # ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + + + + + + + + # --- manually change ticks&labels: + # ax.set_xticks([0.2,1]) + # ax.set_xticklabels(['pos1','pos2']) + + # ax.set_yticks([0, np.pi/8, np.pi/4 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] + # ax.set_yticklabels(labels) + + a=ax.yaxis.get_major_locator() + b=ax.yaxis.get_major_formatter() + c = ax.get_xticks() + d = ax.get_xticklabels() + print('xticks:',c) + print('xticklabels:',d) + + ax.grid(True,which='major',axis='both',alpha=0.3) + + + + + + + # plt.figure() + + # f,ax=plt.subplots(1) + + # plt.title(r''+ yName + '-Plot') + # plt.plot(X_Values, Y_Values,linewidth=2, '.k') + # plt.plot(X_Values, Y_Values,'.k',markersize=1) + # plt.plot(X_Values, Y_Values,'.',markersize=0.8) + + # plt.plot(X_Values, Y_Values) + + # ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + + + + # Gamma = '0' + # ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') + # + # ax.plot([x_plotValues[1],x_plotValues[3]], [y_plotValues[2],y_plotValues[3]] , 'b') + # + # ax.plot(x_rest, y_rest, 'b') + + + # Gamma between + + # x jump values (gamma 0): [0.13606060606060608, 0.21090909090909093] + + # ax.plot([[0,jump_xValues[0]], [0, 0]] , 'b') + # ax.plot([jump_xValues[0],xmin], [y_plotValues[2],y_plotValues[2]] , 'b') + + # ax.plot([[0,0.13606060606060608], [0, 0]] , 'b') + # ax.plot([[0.13606060606060608,xmin], [(math.pi/2),(math.pi/2)]], 'b') + + # jump_xValues[0] + + + + # --- leave out jumps: + # ax.scatter(X_Values, Y_Values) + + # ax.set_xlabel(r"prestrain ratio $\theta_\rho$",labelpad=0) + ax.set_xlabel(r"$\theta_\rho$",labelpad=0) + ax.set_ylabel(r"$\kappa$") + # ax.set_ylabel(r"angle $\alpha$") + + ax.set_title(r"$\gamma = \ $"+str(gamma), fontsize=10) + + + if Jumps: + + # --- leave out jumps: + if gamma == 'infinity': + ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]] , 'forestgreen') + ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'forestgreen') + + + + # ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]]) + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]]) + + + + + # ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) + # ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) + # ax.scatter(X_Values, Y_Values) + # ax.plot(X_Values, Y_Values) + + # plt.plot(x_plotValues, y_plotValues,'.') + # plt.scatter(X_Values, Y_Values, alpha=0.3) + # plt.scatter(X_Values, Y_Values) + # plt.plot(X_Values, Y_Values,'.') + # plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + # plt.axis([0, 6, 0, 20]) + + # ax.set_xlabel(r"volume fraction $\theta$", size=11) + # ax.set_ylabel(r"angle $\angle$", size=11) + # ax.set_xlabel(r"volume fraction $\theta$") + # # ax.set_ylabel(r"angle $\angle$") + # ax.set_ylabel(r"angle $\alpha$") + # plt.ylabel('$\kappa$') + + # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + # Plot every other line.. not the jumps... + + if gamma == '0': + tmp = 1 + for idx, x in enumerate(x_plotValues): + if idx > 0 and tmp == 1: + # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) + ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'forestgreen', zorder=2) + tmp = 0 + else: + tmp = 1 + + # plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) + # plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) + # plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) + # plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) + + + for x in jump_xValues: + plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1, zorder=1) + # plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', label=r'$\theta_*$') + + # plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + + # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') + # plt.legend() + + + # -- SETUP LEGEND + # ax.legend(prop={'size': 11}) + # ax.legend() + + # ------------------ SAVE FIGURE + # tikzplotlib.save("TesTout.tex") + # plt.close() + # mpl.rcParams.update(mpl.rcParamsDefault) + + # plt.savefig("graph.pdf", + # #This is simple recomendation for publication plots + # dpi=1000, + # # Plot will be occupy a maximum of available space + # bbox_inches='tight', + # ) + # plt.savefig("graph.pdf") + + + + # ---- ADD additional scatter: + # ax.scatter(X_Values,Y_Values,s=1,c='black',zorder=4) + + # Find transition point + lastIdx = len(Y_Values)-1 + + for idx, y in enumerate(Y_Values): + if idx != lastIdx: + if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: + transition_point1 = X_Values[idx+1] + print('transition point1:', transition_point1 ) + if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: + transition_point2 = X_Values[idx] + print('transition point2:', transition_point2 ) + if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: + transition_point3 = X_Values[idx+1] + print('transition point3:', transition_point3 ) + + # Add transition Points: + if gamma == '0': + ax.scatter([transition_point1, transition_point2],[np.pi/2,np.pi/2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2+0.012 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + else: + ax.scatter([transition_point1, transition_point2, transition_point3 ],[np.pi/2,np.pi/2,0 ],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2 +0.011 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point3 +0.009 , 0+0.08, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + else: + # ax.scatter(X_Values,Y_Values,s=1, marker='o', cmap=None, norm=None, facecolor = 'blue', + # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) + # l6 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1, label=r"$\theta_\rho = -1.0$") + # l4 = ax.scatter(X_Values,Angle_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l3 = ax.scatter(X_Values,Angle_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # + # line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = 3.0$"] + # ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + # ax.set_yticklabels(labels) + # + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7], + # labels= [ r"$\theta_\rho = 0$", r"$\theta_\rho = -0.125$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.75$", r"$\theta_\rho = -1.0$", r"$\theta_\rho = 3.0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0875,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l3 = ax.scatter(X_Values,Angle_alphaNeg075,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l4 = ax.scatter(X_Values,Angle_alphaNeg0625,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l5 = ax.scatter(X_Values,Angle_alphaNeg05,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l6 = ax.scatter(X_Values,Angle_alphaNeg025,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alphaNeg0125,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l8 = ax.scatter(X_Values,Angle_alpha0,s=2, marker='s', edgecolor = 'black', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + + # l1 = ax.plot(X_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=-0.5$") + # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.6$") + # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.7$") + # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Angle_alphaNeg08, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.8$") + # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Angle_alphaNeg09, color='teal',linestyle = '--', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.9$") + # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + # l11 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-1.0$") + + + # l1 = ax.plot(X_Values,Angle_Theta01, color='blue', linewidth=1.5, zorder=3, label=r"$\theta=0.1$") + # # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_Theta025,color='orangered', linewidth=1.5 ,zorder=3, label=r"$\theta = 0.25$") + # # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Curvature_Theta05,color='orange', linewidth=1.5 ,zorder=3, label=r"$\theta = 0.5$") + # # l6 = ax.plot(X_Values,Curvature_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Curvature_Theta075, linewidth=1.5 , zorder=3, label=r"$\theta = 0.75$") + # # l8 = ax.plot(X_Values,Curvature_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Curvature_Theta09, color='teal', linewidth=1.5 , zorder=3, label=r"$\theta =0.9$") + # # l10 = ax.plot(X_Values,Curvature_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + + + # l1 = ax.scatter(X_Values,Curvature_Theta01, color='blue', s=2, zorder=3, label=r"$\theta=0.1$") + # l2 = ax.plot(X_Values,Curvature_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.scatter(X_Values,Curvature_Theta025,color='orangered', s=2 ,zorder=3, label=r"$\theta = 0.25$") + # l4 = ax.plot(X_Values,Curvature_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + l5 = ax.scatter(X_Values,Curvature_Theta05, color='forestgreen', s=0.15 ,zorder=3, label=r"$\theta = 0.5$") + # l5 = ax.scatter(X_Values,Curvature_Theta05, color='forestgreen' ,zorder=3, label=r"$\theta = 0.5$") + # l6 = ax.plot(X_Values,Curvature_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.scatter(X_Values,Curvature_Theta075, s=2, zorder=3, label=r"$\theta = 0.75$") + # l8 = ax.plot(X_Values,Curvature_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.scatter(X_Values,Curvature_Theta09, color='teal',s=2, zorder=3, alpha=1.0, label=r"$\theta =0.9$") + + # ax.legend(handles=[l1[0],l2[0],l3[0],l4[0], l5[0], l6[0], l7[0], l8[0], l9[0], l10[0], l11[0]], + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l1[0],l3[0], l5[0], l7[0], l9[0]] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l1,l3, l5, l7, l9] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l5] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.plot(X_Values, Y_Values, marker='o', markerfacecolor='orange', markeredgecolor='black', markeredgewidth=1, linewidth=1, zorder=3) + # l7 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # l4 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Curvature_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + + # line_labels = [r"$\theta_\rho = -1.0$",r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = - \frac{3}{4}$", r"$\theta_\rho = - \frac{5}{8}$",r"$\theta_\rho = - 0.5 $" ,r"$\theta_\rho = - 0.25", r"$\theta_\rho = - \frac{1}{8}" , r"$\theta_\rho = 0$"] + ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + ax.set_yticklabels(labels) + + + + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # + # ax.legend(handles=[l1,l3, l5, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # + + + + + + # fig.legend([l1, l2, l3, l4], # The line objects + # labels=line_labels, # The labels for each line + # # loc="upper center", # Position of legend + # loc='upperleft', bbox_to_anchor=(1,1), + # borderaxespad=0.15 # Small spacing around legend box + # # title="Legend Title" # Title for the legend + # ) + + pdf_outputName = 'Plot-Curvature-Alpha_Gamma'+ str(gamma)+ '_transition'+'.pdf' + + fig.set_size_inches(width, height) + # fig.savefig('Plot-Angle-Theta.pdf') + fig.savefig(pdf_outputName) + + + + + # tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + + # tikz_save('fig.tikz', + # figureheight = '\\figureheight', + # figurewidth = '\\figurewidth') + + # ---------------------------------------- + + +# plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot-Curvature-GammaV2_SubPlots.py b/src/Plot-Curvature-GammaV2_SubPlots.py index 36a677ddfa1221f480d2628228d93d9a4827654c..409a33711bc60c29cd7894c13620245357c98346 100644 --- a/src/Plot-Curvature-GammaV2_SubPlots.py +++ b/src/Plot-Curvature-GammaV2_SubPlots.py @@ -151,7 +151,7 @@ beta = 2.0 theta= 0.25 #Test -beta = 10.0 +# beta = 10.0 # alpha_1 = -1.0 # alpha_2 = -0.75 # alpha_3 = -0.5 @@ -434,10 +434,14 @@ line_labels = [r"$\gamma^*$"] # borderaxespad=0.15 # Small spacing around legend box # # title="Legend Title" # Title for the legend # ) -fig.legend([l1], [r"$\gamma^*$"], - # bbox_to_anchor=[0.5, 0.92], - bbox_to_anchor=[0.5, 0.94], - loc='center', ncol=3) + + +# Legend: + +# fig.legend([l1], [r"$\gamma^*$"], +# # bbox_to_anchor=[0.5, 0.92], +# bbox_to_anchor=[0.5, 0.94], +# loc='center', ncol=3) plt.subplots_adjust(wspace=0.4, hspace=0.0) # plt.tight_layout() @@ -445,7 +449,7 @@ plt.subplots_adjust(wspace=0.4, hspace=0.0) # Adjust the scaling factor to fit your legend text completely outside the plot # (smaller value results in more space being made for the legend) # plt.subplots_adjust(right=0.9) -plt.subplots_adjust(bottom=0.2) +# plt.subplots_adjust(bottom=0.2) fig.set_size_inches(width, height) fig.savefig('Plot-Curvature-Gamma.pdf') diff --git a/src/Plot_Prestrain_Lemma1.4.py b/src/Plot_Prestrain_Lemma1.4.py index 6adc9961efbda66491ea357b8dffdc574ccc9acc..c2f8339ca14ac3bf21e173160f860309213e1a8f 100644 --- a/src/Plot_Prestrain_Lemma1.4.py +++ b/src/Plot_Prestrain_Lemma1.4.py @@ -228,6 +228,8 @@ fig,ax = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one pl # d = ax.get_xticklabels() # print('xticks:',c) # print('xticklabels:',d) +# params = {'mathtext.default': 'regular' } +# mpl.rcParams.update(params) ax[0].grid(True,which='major',axis='both',alpha=0.3) ax[1].grid(True,which='major',axis='both',alpha=0.3) @@ -242,8 +244,12 @@ l5 = ax[0].plot(Theta_Values,B1_Values_alpha1 , label=r"$\theta_\rho = 1.0$") l6 = ax[0].plot(Theta_Values,B1_Values_alpha2 , label=r"$\theta_\rho = 2.0$") l7 = ax[0].plot(Theta_Values,B1_Values_alpha10 , label=r"$\theta_\rho = 10.0$") -ax[0].set_xlabel(r"volume fraction $\theta$") -ax[0].set_ylabel(r"prestrain $b_1$") +# ax[0].set_xlabel(r"volume fraction $\theta$") +ax[0].set_xlabel(r"$\theta$",fontsize=10) +# ax[0].set_ylabel(r"prestrain $b_1$") +# ax[0].set_title(r"$\widehat B_{\text{eff},1}^\gamma$", fontsize=10) +ax[0].set_title(r"$\widehat B_{\mathrm{eff},1}^{\gamma}$", fontsize=10) + # Labels to use in the legend for each line line_labels = [r"$\theta_\rho = -10.0$",r"$\theta_\rho = -2.0$",r"$\theta_\rho = -1.0$",r"$\theta_\rho = 0.0$" ,r"$\theta_\rho = 1.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$"] @@ -256,10 +262,14 @@ ax[1].plot(Theta_Values,B2_Values_alpha1 , label=r"$\theta_\rho = 1.0$") ax[1].plot(Theta_Values,B2_Values_alpha2 , label=r"$\theta_\rho = 2.0$") ax[1].plot(Theta_Values,B2_Values_alpha10 , label=r"$\theta_\rho = 10.0$") -ax[1].set_xlabel(r"volume fraction $\theta$") -ax[1].set_ylabel(r"prestrain $b_2$") +# ax[1].set_xlabel(r"volume fraction $\theta$") +ax[1].set_xlabel(r"$\theta$",fontsize=10) +# ax[1].set_ylabel(r"prestrain $b_2$") +# ax[1].set_title(r"$\widehat B_{\text{eff},2}^{\gamma}$", fontsize=10) +ax[1].set_title(r"$\widehat B_{\mathrm{eff},2}^{\gamma}$", fontsize=10) plt.subplots_adjust(wspace=0.4, hspace=0) +# plt.subplots_adjust(wspace=0.8) plt.tight_layout() # ax.plot(Theta_Values,B2_Values_alphaNeg1 ) # ax.plot(Theta_Values,B2_Values_alphaNeg10 ) @@ -357,7 +367,7 @@ fig.legend([l1, l2, l3, l4], # The line objects # Adjust the scaling factor to fit your legend text completely outside the plot # (smaller value results in more space being made for the legend) -plt.subplots_adjust(right=0.8) +plt.subplots_adjust(right=0.80) # ------------------ SAVE FIGURE # tikzplotlib.save("TesTout.tex") diff --git a/src/Plot_Prestrain_Lemma1.4_Betas.py b/src/Plot_Prestrain_Lemma1.4_Betas.py index 10564f7da5e5f6d0ad0c669ba746bd50cd8bc4cd..dcacbc537f6a68944079d2094f53ef23085b5575 100644 --- a/src/Plot_Prestrain_Lemma1.4_Betas.py +++ b/src/Plot_Prestrain_Lemma1.4_Betas.py @@ -283,8 +283,9 @@ l2 = ax.plot(Theta_Values,B2_Values_beta05 , label=r"$\theta_\mu = 0.5$") l3 = ax.plot(Theta_Values,B2_Values_beta1 , label=r"$\theta_\mu = 1.0$") l4 = ax.plot(Theta_Values,B2_Values_beta2 , label=r"$\theta_\mu = 2.0$") l5 = ax.plot(Theta_Values,B2_Values_beta10 , label=r"$\theta_\mu = 10.0$") -ax.set_xlabel(r"volume fraction $\theta$") -ax.set_ylabel(r"prestrain $b_2$") +ax.set_xlabel(r"$\theta$", fontsize=10) +# ax.set_ylabel(r"prestrain $b_2$") +ax.set_title(r"$\widehat B_{\mathrm{eff},2}^{\gamma}$", fontsize=10) line_labels = [r"$\theta_\mu = 0.1$",r"$\theta_\mu = 0.5$", r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 10.0$"] diff --git a/src/Plot_elasticQuantities.py b/src/Plot_elasticQuantities.py index 9e9f8462a41cd16c141227d45d49b187c61fc9c6..52ef53344f80892fc81d449afe61d224dd759da3 100644 --- a/src/Plot_elasticQuantities.py +++ b/src/Plot_elasticQuantities.py @@ -167,7 +167,9 @@ Q2_Values_beta10 = np.array(Q2_Values_beta10 ) # mpl.rcParams['ps.fonttype'] = 42 mpl.rcParams['text.usetex'] = True mpl.rcParams["font.family"] = "serif" -mpl.rcParams["font.size"] = "9" +mpl.rcParams["font.size"] = "10" +# plt.rcParams.update({'font.size': 22}) +# mpl.rcParams["font.size"] = "11" # mpl.rcParams['axes.grid'] = True # plt.rc('font', family='serif', serif='Times') @@ -196,6 +198,7 @@ fig = plt.figure() #main # fig, (ax, ax2) = plt.subplots(ncols=2) fig,ax = plt.subplots(nrows=1,ncols=3,figsize=(width,height)) # more than one plot + # --- set overall Title # fig.suptitle('Example of a Single Legend Shared Across Multiple Subplots') @@ -243,69 +246,79 @@ ax[2].grid(True,which='major',axis='both',alpha=0.3) # ax.plot(Theta_Values,B1_Values , 'royalblue') # ax.plot(Theta_Values,B2_Values , 'royalblue') -l1 = ax[0].plot(Theta_Values,Q1_Values_beta05 , label=r"$\theta_\mu = 0.5$") +# l1 = ax[0].plot(Theta_Values,Q1_Values_beta05 , label=r"$\theta_\mu = 0.5$") l2 = ax[0].plot(Theta_Values,Q1_Values_beta1 , label=r"$\theta_\mu = 1.0$") l3 = ax[0].plot(Theta_Values,Q1_Values_beta2 , label=r"$\theta_\mu = 2.0$") l4 = ax[0].plot(Theta_Values,Q1_Values_beta5 , label=r"$\theta_\mu = 5.0$") l5 = ax[0].plot(Theta_Values,Q1_Values_beta10 , label=r"$\theta_\mu = 10.0$") -ax[0].set_xlabel(r"volume fraction $\theta$") -ax[0].set_ylabel(r" $q_1$") +# ax[0].set_xlabel(r"volume fraction $\theta$") +ax[0].set_xlabel(r"$\theta$",fontsize=10) +# ax[0]ax[2].set_title(r" $q_1/q_2$").set_ylabel(r" $q_1$") +ax[0].set_title(r" $q_1$",fontsize=10) ax[0].xaxis.set_major_locator(MultipleLocator(0.25)) # Labels to use in the legend for each line # line_labels = [r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] -line_labels = [r"$\theta_\mu = 0.5$",r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] +line_labels = [r"$\theta_\mu = 1$", r"$\theta_\mu = 2$", r"$\theta_\mu = 5$", r"$\theta_\mu = 10$"] +# line_labels = [r"$\theta_\mu = 0.5$",r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] -ax[1].plot(Theta_Values,Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$") +# ax[1].plot(Theta_Values,Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$") ax[1].plot(Theta_Values,Q2_Values_beta1 , label=r"$\theta_\rho = 1.0$") ax[1].plot(Theta_Values,Q2_Values_beta2 , label=r"$\theta_\rho = 2.0$") ax[1].plot(Theta_Values,Q2_Values_beta5 , label=r"$\theta_\rho = 5.0$") ax[1].plot(Theta_Values,Q2_Values_beta10 , label=r"$\theta_\rho = 10.0$") -ax[1].set_xlabel(r"volume fraction $\theta$") -ax[1].set_ylabel(r" $q_2$") +# ax[1].set_xlabel(r"volume fraction $\theta$") +ax[1].set_xlabel(r"$\theta$",fontsize=10) +# ax[1].set_ylabel(r" $q_2$") +ax[1].set_title(r" $q_2$",fontsize=10) ax[1].xaxis.set_major_locator(MultipleLocator(0.25)) # ax[1].xaxis.set_minor_locator(MultipleLocator(0.05)) -ax[2].plot(Theta_Values,Q1_Values_beta05/Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$",zorder=5) +# ax[2].plot(Theta_Values,Q1_Values_beta05/Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$",zorder=5) ax[2].plot(Theta_Values,Q1_Values_beta1/Q2_Values_beta1 , label=r"$\theta_\rho = 1.0$") ax[2].plot(Theta_Values,Q1_Values_beta2/Q2_Values_beta2 , label=r"$\theta_\rho = 2.0$") ax[2].plot(Theta_Values,Q1_Values_beta5/Q2_Values_beta5 , label=r"$\theta_\rho = 5.0$") ax[2].plot(Theta_Values,Q1_Values_beta10/Q2_Values_beta10 , label=r"$\theta_\rho = 10.0$") -ax[2].set_xlabel(r"volume fraction $\theta$") -ax[2].set_ylabel(r" $q_1/q_2$") +# ax[2].set_xlabel(r"volume fraction $\theta$") +ax[2].set_xlabel(r"$\theta$",fontsize=10) +# ax[2].set_ylabel(r" $q_1/q_2$") +ax[2].set_title(r" $q_1/q_2$",fontsize=10) ax[2].xaxis.set_major_locator(MultipleLocator(0.25)) -plt.subplots_adjust(wspace=0.4, hspace=0) +# plt.subplots_adjust(wspace=0.4, hspace=0.25) +# plt.subplots_adjust(hspace=0.15, wspace=0.25) +plt.subplots_adjust(wspace=0.8) plt.tight_layout() -# fig.legend([l1, l2, l3, l4], # The line objects -# labels=line_labels, # The labels for each line -# loc="center right", # Position of legend -# borderaxespad=0.15 # Small spacing around legend box -# # title="Legend Title" # Title for the legend -# ) - - -fig.legend([l1, l2, l3, l4,l5], # The line objects +fig.legend([l2, l3, l4, l5], # The line objects labels=line_labels, # The labels for each line loc="center right", # Position of legend + # borderaxespad=0.05 # Small spacing around legend box borderaxespad=0.15 # Small spacing around legend box # title="Legend Title" # Title for the legend ) + +# fig.legend([l1, l2, l3, l4,l5], # The line objects +# labels=line_labels, # The labels for each line +# loc="center right", # Position of legend +# borderaxespad=0.15 # Small spacing around legend box +# # title="Legend Title" # Title for the legend +# ) + # Adjust the scaling factor to fit your legend text completely outside the plot # (smaller value results in more space being made for the legend) -plt.subplots_adjust(right=0.8) +plt.subplots_adjust(right=0.83) # ------------------ SAVE FIGURE # tikzplotlib.save("TesTout.tex") diff --git a/src/Plotq12.py b/src/Plotq12.py index 1fee96ef7bdc152621a80ecc232333593fed4acd..3f7aadd26f902462c3a3f15a4c9757bddae8fb95 100644 --- a/src/Plotq12.py +++ b/src/Plotq12.py @@ -40,7 +40,7 @@ print("Path: ", path) #--------------------------------------------------------------- Lambda_Values = np.linspace(0.0, 10.0, num=11) -Lambda_Values = np.linspace(0.0, 5.0, num=6) +# Lambda_Values = np.linspace(0.0, 5.0, num=6) # Lambda_Values = np.linspace(3.0, 5.0, num=20) print(Lambda_Values) q12 = [] diff --git a/src/plot_Elastic_and_PrestrainRatio.py b/src/plot_Elastic_and_PrestrainRatio.py index 6604a58eecb3b5b462e96810ed7f50592fe8c418..fa76d910f587388564b8a705a48fa131a058adf4 100644 --- a/src/plot_Elastic_and_PrestrainRatio.py +++ b/src/plot_Elastic_and_PrestrainRatio.py @@ -172,6 +172,9 @@ for gamma in Gamma_Values: # thetas_ = np.linspace(0.05,0.25,SamplePoints_2D) # betas_ = 10.0 alphas_ = -0.5 + # alphas_ = -3.0 + # alphas_ = -3.0 + alphas_ = 5.0 betas_ = np.linspace(1.01,10.01,SamplePoints_3D) #TEST !!!!! For Beta <1 weird tings happen... alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') @@ -189,8 +192,8 @@ for gamma in Gamma_Values: GetMuGammaVec = np.vectorize(GetMuGamma) muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) - q1 = harmonicMeanVec(mu1, betas, thetas) - q2 = arithmeticMeanVec(mu1, betas, thetas) + q1 = (1.0/6.0)*harmonicMeanVec(mu1, betas, thetas) + q2 = (1.0/6.0)*arithmeticMeanVec(mu1, betas, thetas) b1 = prestrain_b1Vec(rho1, betas, alphas, thetas) b2 = prestrain_b2Vec(rho1, betas, alphas, thetas) @@ -213,6 +216,10 @@ for gamma in Gamma_Values: print('q2:', q2) print('q1/q2:', q1/q2) + print('prestrain ratio b1/b2:', prestrainRatio) + print('max prestrain ratio:', np.max(prestrainRatio)) + print('min prestrain ratio:', np.min(prestrainRatio)) + GammaString = str(gamma) VTKOutputName = "outputs/ElasticRatio" #+ "Gamma_" + GammaString