-
Notifications
You must be signed in to change notification settings - Fork 1
/
fs_plot.py
817 lines (688 loc) · 22.6 KB
/
fs_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
#!/usr/bin/env python3
"""
Copyright 2023 T I Weinberger
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Plot Fermi Surfaces
"""
import numpy as np
from matplotlib import pyplot as plt
import pyvista as pv
import seaborn as sns
import re
import glob
import scienceplots
from scipy.ndimage import map_coordinates
import argparse
import ast
# define some plotting parameters for rough
# plotting of output
plt.style.use(["nature"])
cp = sns.color_palette("Set2")
# pv.rcParams['transparent_background'] = True
def read_bxsf_info(file_name):
# open and read file
f = open(file_name, "r")
lines = f.readlines()
"""
this corresponds to code for getting the fermi energy
"""
# get fermi energy
x = lines[1].split(" ")
x = [val for _, val in enumerate(x) if val != ""]
x = [val for _, val in enumerate(x) if val != "\t"]
x = x[-1].split("\n")
# convert ef to a number
e_f = float(x[0])
# get fermi energy
band_index = re.findall(r"\d+", lines[12])[0]
"""
Now get the dimensions of the k mesh
"""
# get dimensions
x = re.findall(r"\d+", lines[7])
# convert dimensions to integer values
dimensions = [int(dim) for dim in x]
"""
Get basis vectors
"""
# first spanning vector
vec_1 = lines[9].split(" ")
vec_1 = [val.strip("\n") for val in vec_1]
vec_1 = [val.strip("\t") for val in vec_1]
vec_1 = [val for _, val in enumerate(vec_1) if val != ""]
# convert dimensions to float values
vec_1 = [float(val) for val in vec_1]
# second spanning vector
vec_2 = lines[10].split(" ")
vec_2 = [val.strip("\n") for val in vec_2]
vec_2 = [val.strip("\t") for val in vec_2]
vec_2 = [val for _, val in enumerate(vec_2) if val != ""]
# convert dimensions to float values
vec_2 = [float(val) for val in vec_2]
# thrid spanning vector
vec_3 = lines[11].split(" ")
vec_3 = [val.strip("\n") for val in vec_3]
vec_3 = [val.strip("\t") for val in vec_3]
vec_3 = [val for _, val in enumerate(vec_3) if val != ""]
# convert dimensions to float values
vec_3 = [float(val) for val in vec_3]
vec_1 = np.array(vec_1)
vec_2 = np.array(vec_2)
vec_3 = np.array(vec_3)
cell = np.array([vec_1, vec_2, vec_3])
# close file
f.close()
return vec_1, vec_2, vec_3, dimensions, band_index, e_f, cell
def read_bxsf(file_name, scale, order, shift_energy, fermi_velocity):
"""
Reads .bxsf file and determines two
matrices, one corresponding to the eigenvalues
and the other the k space vectors
returns:
k_vectors
eigenvalues
ef
"""
# open and read file
f = open(file_name, "r")
lines = f.readlines()
"""
Get general bxsf information
"""
vec_1, vec_2, vec_3, dimensions, band_index, e_f, cell = read_bxsf_info(
file_name
)
vec_1 = vec_1*(dimensions[0]+1)/dimensions[0]
vec_2 = vec_2*(dimensions[1]+1)/dimensions[1]
vec_3 = vec_3*(dimensions[2]+1)/dimensions[2]
"""
Now extract eigenvalues
"""
# get everything after band index
lines_conc = "".join(lines)
for line in lines:
if "BAND:" in line and band_index in line:
eigen_text = lines_conc.split(line)[1]
break
eigen_text = eigen_text.split("END_BANDGRID_3D")[0]
eigen_text = re.sub(' +', ' ', eigen_text)
eigen_vals = eigen_text.split(" ")
eigen_vals = [val.strip("\n") for val in eigen_vals]
eigen_vals = eigen_vals[1:-1]
eigen_vals = [float(val) for val in eigen_vals]
eigenvalues = np.array(eigen_vals).reshape(dimensions)
eig_vals = np.zeros(dimensions)
for i in range(dimensions[0]):
for j in range(dimensions[1]):
for k in range(dimensions[2]):
eig_vals[i, j, k] = eigen_vals[
dimensions[2] * dimensions[1] * i + dimensions[2] * j + k
]
eig_vals = np.tile(eig_vals, (2, 2, 2))
eig_vals = np.delete(eig_vals, dimensions[0], axis=0)
eig_vals = np.delete(eig_vals, dimensions[1], axis=1)
eig_vals = np.delete(eig_vals, dimensions[2], axis=2)
if scale != 1:
# interpolation here
dimensions_int = [int(scale * dimension) for dimension in dimensions]
x_vals_int = np.linspace(
0, 2 * dimensions[0] - 2, 2 * dimensions_int[0] - 2 * scale + 1
)
y_vals_int = np.linspace(
0, 2 * dimensions[1] - 2, 2 * dimensions_int[1] - 2 * scale + 1
)
z_vals_int = np.linspace(
0, 2 * dimensions[2] - 2, 2 * dimensions_int[2] - 2 * scale + 1
)
x_vals_int, y_vals_int, z_vals_int = np.meshgrid(
x_vals_int, y_vals_int, z_vals_int
)
out_grid_x, out_grid_y, out_grid_z = np.meshgrid(
range(-dimensions_int[0] + scale, dimensions_int[0] - scale + 1),
range(-dimensions_int[1] + scale, dimensions_int[1] - scale + 1),
range(-dimensions_int[2] + scale, dimensions_int[2] - scale + 1),
)
out_grid_x = out_grid_x / scale
out_grid_y = out_grid_y / scale
out_grid_z = out_grid_z / scale
out_coords = np.array(
(x_vals_int.ravel(), y_vals_int.ravel(), z_vals_int.ravel())
)
# x_vals_int, y_vals_int, z_vals_int = np.meshgrid(x_vals_int, y_vals_int, z_vals_int)
out_data = map_coordinates(
eig_vals, out_coords, order=order, mode="reflect"
)
out_data = out_data.reshape(
2 * dimensions_int[0] - 2 * scale + 1,
2 * dimensions_int[1] - 2 * scale + 1,
2 * dimensions_int[2] - 2 * scale + 1,
)
else:
out_data = eig_vals
dimensions_int = dimensions
out_grid_y, out_grid_x, out_grid_z = np.meshgrid(
range(-dimensions_int[0] + 1, dimensions_int[0]),
range(-dimensions_int[1] + 1, dimensions_int[1]),
range(-dimensions_int[2] + 1, dimensions_int[2]),
)
x_vals = []
y_vals = []
z_vals = []
# Transform index matrix into coordinate matrix in k space
k_vectors = np.zeros(
[2 * dimension + 1 - 2 * scale for dimension in dimensions_int] + [3]
)
k_vectors[:] = (
np.outer(out_grid_x, vec_1).reshape(
[2 * dimension + 1 - 2 * scale for dimension in dimensions_int]
+ [3]
)
+ np.outer(out_grid_y, vec_2).reshape(
[2 * dimension + 1 - 2 * scale for dimension in dimensions_int]
+ [3]
)
+ np.outer(out_grid_z, vec_3).reshape(
[2 * dimension + 1 - 2 * scale for dimension in dimensions_int]
+ [3]
)
)
k_vectors = k_vectors.reshape(
(2 * dimensions_int[0] + 1 - 2 * scale)
* (2 * dimensions_int[1] + 1 - 2 * scale)
* (2 * dimensions_int[2] + 1 - 2 * scale),
3,
)
x_vals = k_vectors[:, 0]
y_vals = k_vectors[:, 1]
z_vals = k_vectors[:, 2]
# create a structured grid to store the data and reshape to the correct dimensions
grid = pv.StructuredGrid(
np.array(x_vals) / dimensions[0],
np.array(y_vals) / dimensions[1],
np.array(z_vals) / dimensions[2],
)
grid.dimensions = [
2 * dimensions_int[2] + 1 - 2 * scale,
2 * dimensions_int[1] + 1 - 2 * scale,
2 * dimensions_int[0] + 1 - 2 * scale,
]
# create a structured grid
# (for this simple example we could've used an unstructured grid too)
# note the fortran-order call to ravel()!
# grid = pv.StructuredGrid(X, Y, Z)
grid.point_data["values"] = out_data.flatten() # also the active scalars
# calculate gradient
if fermi_velocity == True:
grid = grid.compute_derivative(scalars="values")
iso1 = grid.contour(
isosurfaces=1,
rng=[
e_f + shift_energy,
e_f + shift_energy,
],
)
if fermi_velocity == True:
iso1 = iso1.compute_normals()
vf = np.einsum(
"ij,ij->i", iso1.point_data["Normals"], iso1["gradient"]
)
if scale > 1:
iso1.point_data["fermi_velocity"] = -vf
else:
iso1.point_data["fermi_velocity"] = vf
isos = [iso1]
# or: mesh.contour(isosurfaces=np.linspace(10, 40, 3)) etc.
dimensions = dimensions_int
# close file
f.close()
return k_vectors, eig_vals, e_f, cell, dimensions, isos
def get_brillouin_zone_3d(cell):
"""
Uses the k-space vectors and voronoi analysis to define
the BZ of the system
Args:
cell: a 3x3 matrix defining the basis vectors in
reciprocal space
Returns:
vor.vertices[bz_vertices]: vertices of BZ
bz_ridges: edges of the BZ
bz_facets: BZ facets
"""
px, py, pz = np.tensordot(cell, np.mgrid[-1:2, -1:2, -1:2], axes=[0, 0])
points = np.c_[px.ravel(), py.ravel(), pz.ravel()]
from scipy.spatial import Voronoi
vor = Voronoi(points)
bz_facets = []
bz_ridges = []
bz_vertices = []
for pid, rid in zip(vor.ridge_points, vor.ridge_vertices):
if pid[0] == 13 or pid[1] == 13:
bz_ridges.append(vor.vertices[np.r_[rid, [rid[0]]]])
bz_facets.append(vor.vertices[rid])
bz_vertices += rid
bz_vertices = list(set(bz_vertices))
return vor.vertices[bz_vertices], bz_ridges, bz_facets
def args_parser():
"""Function to take input command line arguments"""
parser = argparse.ArgumentParser(
description="Fermi Surface Plotter",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"-n",
"--name",
metavar="\b",
type=str,
help="Name of the bxsf file in which data is stored",
required=True,
)
parser.add_argument(
"-i",
"--interpolation-factor",
metavar="\b",
type=int,
default=1,
help="Degree of interpolation of Fermi surface",
)
parser.add_argument(
"-b",
"--bands",
metavar="\b",
type=str,
help="List of bands to include in plot",
)
parser.add_argument(
"-z",
"--zoom",
metavar="\b",
type=float,
help="Zoom factor of saved image",
default=1.0,
)
parser.add_argument(
"-se",
"--shift-energy",
metavar="\b",
type=float,
help="Shift in the Fermi energy from the DFT/input value",
default=0.0,
)
parser.add_argument(
"-a",
"--azimuth",
metavar="\b",
type=float,
help="Azimuthal angle of camera",
default=65,
)
parser.add_argument(
"-e",
"--elevation",
metavar="\b",
type=float,
help="Elevation angle of camera",
default=30,
)
parser.add_argument(
"-o",
"--order",
metavar="\b",
type=int,
help="Order of spline for interpolation between 1 and 5",
default=3,
)
parser.add_argument(
"-s",
"--spin",
metavar="\b",
type=str,
choices=["u", "d", "ud", "n"],
help="Whether the bands are spin polarised and hence which spins to choose. Options: ['u', 'd', 'ud', 'n']",
default="n",
)
parser.add_argument(
"-vf",
"--fermi-velocity",
metavar="\b",
type=bool,
help="Compute the Fermi velocity on the surface",
default=False,
)
parser.add_argument(
"-lw",
"--line-width",
metavar="\b",
type=float,
help="Linewidth for the Brillouin Zone plot",
default=2.0,
)
parser.add_argument(
"-op",
"--opacity",
metavar="\b",
type=float,
help="Opacity of the Fermi surface plot, Range: [0, 1]",
default=1.0,
)
parser.add_argument(
"-r",
"--resolution",
metavar="\b",
type=float,
help="Resoltuion of saved pdf image",
default=1.0,
)
parser.add_argument(
"-int",
"--interactive",
metavar="\b",
type=bool,
help="Interactive Fermi Surface visualisation",
default=True,
)
parser.add_argument(
"-bn",
"--band-name",
metavar="\b",
type=bool,
help="Add Band index to the plots",
default=False,
)
parser.add_argument(
"-f",
"--format",
type=str,
help="The format of the saved figure (png, jpg, pdf). Multiple choice are allowed.",
choices=["png", "jpg", "pdf"],
default='pdf',
)
parser.add_argument(
"-pr",
"--projection",
type=str,
help="Whether surfaces are projected in parallel mode or perspective",
choices=["parallel", "perspective", "par", "per"],
default='parallel',
)
return parser
def load_files(args):
"""Function to load in bxsf files taking arguments
to determine whether we have a spin polarised case
Args:
args: command line arguments
Returns:
files: list of files in be included in plots
"""
# load up bxsf files
if args.bands is not None:
bands = ast.literal_eval(args.bands)
files = []
for band in bands:
try:
if args.spin == "u":
files += glob.glob(
file_name + "*bxsf.band-" + str(band) + "_up"
)
elif args.spin == "d":
files += glob.glob(
file_name + "*bxsf.band-" + str(band) + "_up"
)
elif args.spin == "ud":
files += glob.glob(
file_name + "*bxsf.band-" + str(band) + "_*"
)
elif args.spin == "n":
files += glob.glob(file_name + "*bxsf.band-" + str(band))
except:
print(
f"Error: No matching band indices found for band {band}, check band indices"
)
exit()
else:
files = glob.glob(file_name + "*bxsf.band-*")
if args.spin == "u":
files = [file for file in files if file[-2:] == "up"]
elif args.spin == "d":
files = [file for file in files if file[-2:] == "dn"]
elif args.spin == "ud":
files = [
file
for file in files
if file[-2:] == "dn" or file[-2:] == "up"
]
elif args.spin == "n":
files = [
file
for file in files
if file[-2:] != "dn" and file[-2:] != "up"
]
return files
# parse command line arguments
parser = args_parser()
args = parser.parse_args()
# assign parsed command line arguments
file_name = args.name
scale = args.interpolation_factor
order = args.order
opacity = args.opacity
formt = args.format
#get the projection
projection = args.projection
if projection == "par":
projection = "parallel"
if projection == "per":
projection == "perspective"
# load in bxsf files
files = load_files(args)
# error checking
if len(files) == 0:
print("Error: No .bxsf files found, check file name")
exit()
if scale < 1:
print("Error: Please choose a scaling factor greater than 0.5")
exit()
if order < 1 or order > 5:
print("Error: Please choose a interpolation order between 1 aned 5")
exit()
if opacity > 1 or opacity < 0:
print("Error: Please choose an opacity between 0 and 1")
exit()
if formt not in ["png", "jpg", "pdf"]:
print('Error: File format not allowed')
exit()
if projection not in ["parallel", "perspective", "par", "per"]:
print('Error: Projection type not allowed')
exit()
# initialise 3D visualisation
plotter = pv.Plotter(
off_screen=True,
window_size=[
int(round(args.resolution * 1024)),
int(round(args.resolution * 768)),
],
)
if projection == "parallel":
plotter.enable_parallel_projection()
if args.interactive == True:
plotter_int = pv.Plotter()
if projection == "parallel":
plotter_int.enable_parallel_projection()
# get cell for FS plot
_, _, _, _, _, _, cell = read_bxsf_info(files[0])
# generate BZ from voronoi analysis
v, e, f = get_brillouin_zone_3d(cell)
# triangulate BZ surface
bz_surf = pv.PolyData(v)
bz_surf = bz_surf.delaunay_3d()
bz_surf = bz_surf.extract_surface()
edges = bz_surf.extract_all_edges()
# make output colorlist
color_list = sns.color_palette("hls", 2 * len(files))
counter = 0
for file in files:
print(file)
k_vectors, eig_vals, e_f, cell, dimensions, isos = read_bxsf(
file,
scale,
order=order,
shift_energy=args.shift_energy,
fermi_velocity=args.fermi_velocity,
)
vec1 = cell[0] * (dimensions[0] - scale) / dimensions[0]
vec2 = cell[1] * (dimensions[1] - scale) / dimensions[1]
vec3 = cell[2] * (dimensions[2] - scale) / dimensions[2]
plotter_ind = pv.Plotter(
off_screen=True,
window_size=[
int(round(args.resolution * 1024)),
int(round(args.resolution * 768)),
],
)
if projection == "parallel":
plotter_ind.enable_parallel_projection()
for iso in isos:
try:
iso = iso.clip_surface(bz_surf, invert=True)
if args.fermi_velocity == True:
plotter_ind.add_mesh(
iso,
lighting=True,
scalars="fermi_velocity",
cmap="turbo",
opacity=1.0,
)
plotter.add_mesh(
iso,
lighting=True,
scalars="fermi_velocity",
cmap="turbo",
opacity=1.0,
)
if args.interactive == True:
plotter_int.add_mesh(
iso,
lighting=True,
scalars="fermi_velocity",
cmap="turbo",
opacity=1.0,
)
else:
plotter.add_mesh(
iso,
lighting=True,
color=color_list[2 * counter],
opacity=args.opacity,
backface_params={"color": color_list[2 * counter + 1]},
)
plotter_ind.add_mesh(
iso,
lighting=True,
color=color_list[2 * counter],
opacity=args.opacity,
backface_params={"color": color_list[2 * counter + 1]},
)
if args.interactive == True:
plotter_int.add_mesh(
iso,
lighting=True,
color=color_list[2 * counter],
opacity=args.opacity,
backface_params={"color": color_list[2 * counter + 1]},
)
except:
# print(file + " contains an empty mesh")
pass
for xx in e:
line = pv.MultipleLines(
points=np.array([xx[:, 0], xx[:, 1], xx[:, 2]]).T
)
plotter_ind.add_mesh(
line,
color="black",
line_width=args.resolution * args.line_width,
)
plotter_ind.set_background("white")
plotter_ind.camera_position = "yz"
plotter_ind.set_position([0.5 / args.zoom, 0, 0])
plotter_ind.camera.azimuth = args.azimuth
plotter_ind.camera.elevation = args.elevation
band_index = file.split(".")[-1]
if args.fermi_velocity == True:
plotter_ind.remove_scalar_bar()
if args.band_name == True:
plotter_ind.add_title('Band ' + band_index.split('-')[1])
# Save individual plots
if formt == "pdf":
plotter_ind.save_graphic("FS_side_" + band_index + ".pdf")
elif formt == "png":
plotter_ind.screenshot("FS_side_" + band_index + ".png")
elif formt == "jpg":
plotter_ind.screenshot("FS_side_" + band_index + ".jpg")
counter += 1
# plot BZ
for xx in e:
line = pv.MultipleLines(points=np.array([xx[:, 0], xx[:, 1], xx[:, 2]]).T)
plotter.add_mesh(
line, color="black", line_width=args.resolution * args.line_width
)
if args.interactive == True:
plotter_int.add_mesh(line, color="black", line_width=args.line_width)
if args.fermi_velocity == True:
plotter.remove_scalar_bar()
plotter.set_background("white")
plotter.camera_position = "yz"
plotter.set_position([0.5 / args.zoom, 0, 0])
plotter.camera.azimuth = args.azimuth
plotter.camera.elevation = args.elevation
if args.band_name == True:
plotter.add_title('Total Fermi Surface')
# Save overall plot
if formt == "pdf":
plotter.save_graphic("FS.pdf")
elif formt == "png":
plotter.screenshot("FS.png")
elif formt == "jpg":
plotter.screenshot("FS.jpg")
if args.interactive == True:
plotter_int.set_background("white")
plotter_int.camera_position = "yz"
plotter_int.set_position([0.5 / args.zoom, 0, 0])
plotter_int.camera.azimuth = args.azimuth
plotter_int.camera.elevation = args.elevation
if args.fermi_velocity == True:
plotter_int.remove_scalar_bar()
plotter_int.show()
camera_coord = np.array(
[
plotter_int.camera.position[0],
plotter_int.camera.position[1],
plotter_int.camera.position[2],
]
)
if plotter_int.camera.position[1] != 0:
elevation_rad = np.arctan(
plotter_int.camera.position[2] / plotter_int.camera.position[1]
)
elevation_deg = np.degrees(elevation_rad)
else:
elevation_deg = 90
if plotter_int.camera.position[1] != 0:
azimuth_rad = np.arctan(
plotter_int.camera.position[0] / plotter_int.camera.position[1]
)
azimuth_deg = np.degrees(azimuth_rad)
else:
azimuth_deg = 90
zoom = 0.5 / np.linalg.norm(camera_coord)
print("\nFinal Camera coordinates were:")
print(f"\tAzimuthal angle: {azimuth_deg}")
print(f"\tElevation: {elevation_deg}")
print(f"\tZoom: {zoom}")