2 :filename: gen_output.py
3 :synopsis: Main driver for dfnGen output report
5 :maintainer: Jeffrey Hyman
6 :moduleauthor: Jeffrey Hyman <jhyman@lanl.gov>
9 import matplotlib.pylab
as plt
15 """ Creates PDF plots of fracture intersection lengths in the domain. First all fractures are plotted, then by family.
20 General dictionary of output analysis code. Contains information on number of families, number of fractures, and colors.
22 families: list of fracture family dictionaries
23 Created by get_family_information
32 For larger networks, it can take a long time to sort intersections by family.
34 This function is only called with robust = True
36 PDF files are dumped into family/figures. There is one figure for all fractures dfnGen_output_report/networks/ and one per family dfnGen_output_report/family_{family_id}
38 Information about intersection modification during generation has not been include yet, but it should be.
41 print(
"--> Plotting Intersection Distributions")
47 data = np.genfromtxt(
"intersection_list.dat", skip_header=1)
50 intersection_lengths = data[:, -1]
53 num_intersections = len(f1)
55 print(f
"There are {num_intersections} intersections")
56 fig, axs = plt.subplots(figsize=(10, 7))
57 sns.kdeplot(intersection_lengths, color=
"k")
58 labs = [
"Entire Network"]
62 for i
in range(num_intersections):
63 if params[
"verbose"]
and i % 1000 == 0:
64 print(f
"--> Intersection number {i}")
68 if f1[i] > 0
and f2[i] > 0:
69 if f1[i]
in fam[
"fracture list - final"]:
70 i1 = fam[
'Global Family']
71 if f2[i]
in fam[
"fracture list - final"]:
72 i2 = fam[
'Global Family']
80 print(f
"--> Working on family {fam['Global Family']}")
82 for i
in range(num_intersections):
83 if idx[i][0] == fam[
'Global Family']
or idx[i][1] == fam[
85 family_lengths.append(intersection_lengths[i])
87 labs += [f
"Family: {fam['Global Family']}"]
88 sns.kdeplot(family_lengths, color=fam[
"color"])
90 plt.legend(loc=
"upper right", labels=labs, fontsize=14)
91 plt.xlabel(
"Intersection Length [m]", fontsize=24)
92 plt.ylabel(
"Density", fontsize=24)
93 axs.set_xticklabels(axs.get_xticks().astype(int), fontsize=14)
94 ticks = axs.get_yticks()
95 labels = [f
"{val:0.2f}" for val
in ticks]
96 axs.set_yticklabels(labels, fontsize=14)
97 plt.savefig(f
"{params['output_dir']}/network/network_intersections.png")
100 if params[
"verbose"]:
101 print(f
"--> Individual Family Plots")
105 fig, axs = plt.subplots(figsize=(10, 7))
107 if params[
"verbose"]:
108 print(f
"--> Working on family {fam['Global Family']}")
110 for i
in range(num_intersections):
111 if idx[i][0] == fam[
'Global Family']
or idx[i][1] == fam[
113 family_lengths.append(intersection_lengths[i])
115 sns.kdeplot(family_lengths, color=params[
"final_color"])
116 plt.xlabel(
"Intersection Length [m]", fontsize=24)
117 plt.ylabel(
"Density", fontsize=24)
118 axs.set_xticklabels(axs.get_xticks().astype(int), fontsize=16)
119 ticks = axs.get_yticks()
120 labels = [f
"{val:0.2f}" for val
in ticks]
121 axs.set_yticklabels(labels, fontsize=16)
123 f
"{params['output_dir']}/family_{fam['Global Family']}/family_{fam['Global Family']}_intersections.png"
def plot_intersection_lengths(params, families)