Skip to content

migrate from python2 to python3 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions Analysis/Section_Props_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import matplotlib
matplotlib.use('TKAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import Tkinter as tk
import tkinter as tk
import os
import math
import tkMessageBox
import tkinter.messagebox as tkMessageBox

def path_exists(path):
res_folder_exist = os.path.isdir(path)
Expand Down Expand Up @@ -345,40 +344,40 @@ def run_file(self):
i=0
for i in range(0,num_vertices):
i_x =i_x + (vertices_y[i]**2+vertices_y[i]*vertices_y[i+1]+vertices_y[i+1]**2)*(vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(i_x)
print (str(i_x))
i_x = i_x/12
i_x = i_x

i=0
for i in range(0,num_vertices):
i_y = i_y + (vertices_x[i]**2+vertices_x[i]*vertices_x[i+1]+vertices_x[i+1]**2)*(vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(i_y)
print (str(i_y))
i_y = i_y/12
i_y = i_y

i=0
for i in range(0,num_vertices):
i_xy = i_xy + (vertices_x[i]*vertices_y[i+1]+2*vertices_x[i]*vertices_y[i]+2*vertices_x[i+1]*vertices_y[i+1]+vertices_x[i+1]*vertices_y[i])*(vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(i_xy)
print (str(i_xy))
i_xy = i_xy/24
i_xy = i_xy

i=0
for i in range(0,num_vertices):
area = area + (vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(area)
print (str(area))
area = area/2

i=0
for i in range(0,num_vertices):
x_bar = x_bar + (vertices_x[i]+vertices_x[i+1])*(vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(x_bar)
print (str(x_bar))
x_bar = x_bar / (6*area)

i=0
for i in range(0,num_vertices):
y_bar = y_bar + (vertices_y[i]+vertices_y[i+1])*(vertices_x[i]*vertices_y[i+1]-vertices_x[i+1]*vertices_y[i])
print str(y_bar)
print (str(y_bar))
y_bar = y_bar/(6*area)

i_x_bar = i_x - area*y_bar**2
Expand Down Expand Up @@ -470,4 +469,4 @@ def main():
root.mainloop()

if __name__ == '__main__':
main()
main()
35 changes: 17 additions & 18 deletions Analysis/beam_patterning.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from __future__ import division
import matplotlib
matplotlib.use('TKAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import Tkinter as tk
from Tkinter import PhotoImage
import tkFileDialog
import tkFont
import tkinter as tk
from tkinter import PhotoImage
import tkinter.filedialog as tkFileDialog
import tkinter.font as tkFont
import numpy as np
from numpy.linalg import inv
from numpy import unravel_index
Expand All @@ -18,7 +17,7 @@
import os
import itertools
import math
import tkMessageBox
import tkinter.messagebox as tkMessageBox
import time

def load_pattern(num_spans):
Expand Down Expand Up @@ -730,7 +729,7 @@ def __init__(self, master):

self.per_span_res_frame = tk.Frame(self.frame_selection,relief='sunken')
stations = Main_window.stations
print stations
print (stations)
self.span_res_scale = tk.Scale(self.per_span_res_frame, from_=0, to=stations, orient=tk.HORIZONTAL, label = "Location in Span:", length = 300, command=self.span_res_run)
self.span_res_scale.pack(side=tk.TOP, padx=5, pady=5)
self.span_res_b_plus = tk.Button(self.per_span_res_frame,text='+', command = self.set_span_res_plus)
Expand Down Expand Up @@ -2412,7 +2411,7 @@ def run_file(self):
wind_y.append(holder)
Main_window.load_exist[10]=1
else:
print 'no load kind'
print ('no load kind')
else:
pass

Expand Down Expand Up @@ -2509,7 +2508,7 @@ def run_file(self):
Main_window.total_deflection_goal.append(span/240)

startt = time.time()
print 'Perform analysis for all load types defined....'
print ('Perform analysis for all load types defined....')
for i in range(0,11):
if i in range(5,9):
if len(loads[i][1][0]) == 0:
Expand Down Expand Up @@ -2539,14 +2538,14 @@ def run_file(self):
Main_window.xs,Main_window.displace_initial_results[0],Main_window.displace_initial_results[1],Main_window.displace_initial_results[2],Main_window.displace_initial_results[3], Main_window.displace_initial_results[4], Main_window.displace_initial_results[5] = three_moment_method(beam_spans, beam_momentofinertia, cant, [[0.00,0.00,0.00,0.00,'POINT',0,0]], E, iters, displace_initial)

endt = time.time()
print '**Analysis Complete** in {0:.4f} sec'.format(endt-startt)
print ('**Analysis Complete** in {0:.4f} sec'.format(endt-startt))

Main_window.load_results = loads
Main_window.bm = np.zeros((iters+1,N))
# # ['D', 'Ex', 'Ey', 'F', 'H', 'L', 'Lr', 'R', 'S', 'Wx', 'Wy']
# # data structure for each non patterned load type [['D'],[loads],[shears],[moments],[slopes],[deflections],[Support Reactions],[Moments at supports]]

print 'Factoring Loads and Generating Graphs...'
print ('Factoring Loads and Generating Graphs...')

fi = float(self.fi_lrfd.get())
fy = float(self.fy_lrfd.get())
Expand Down Expand Up @@ -2618,7 +2617,7 @@ def run_file(self):


#Factor and combine loads and Print Results to text File
print 'LRFD Combinations...'
print ('LRFD Combinations...')
Main_window.lrfd_v = []
Main_window.lrfd_m = []
Main_window.lrfd_r = []
Expand Down Expand Up @@ -2696,7 +2695,7 @@ def run_file(self):
Main_window.lrfd_m_support_env_min.append(np.minimum.reduce(m_pattern))
Main_window.lrfd_m_support_env_max.append(np.maximum.reduce(m_pattern))

print 'ASD/BASIC Combinations...'
print ('ASD/BASIC Combinations...')
Main_window.basic_v = []
Main_window.basic_m = []
Main_window.basic_s = []
Expand Down Expand Up @@ -2799,7 +2798,7 @@ def run_file(self):
Main_window.basic_r_env_min.append(np.minimum.reduce(r_pattern))
Main_window.basic_m_support_env_min.append(np.minimum.reduce(m_pattern))

print 'Enveloping Results...'
print ('Enveloping Results...')

Main_window.lrfd_Rmax_print = np.maximum.reduce(Main_window.lrfd_r_env_max)
Main_window.lrfd_Rmin_print = np.minimum.reduce(Main_window.lrfd_r_env_min)
Expand All @@ -2825,7 +2824,7 @@ def run_file(self):
Main_window.asd_d_min_diag = np.minimum.reduce(Main_window.basic_d_env_min)

#Create CSV file of LRFD Envelope Results
print 'Writing CSV Files...'
print ('Writing CSV Files...')
file = open(os.path.join(path,bmlabel+'_04_LRFD_Envelope_Results.csv'),'w')
file.write('LRFD Envelope Results\n')
file.write('Spans:,'+str(N))
Expand Down Expand Up @@ -2869,7 +2868,7 @@ def run_file(self):

cad_points = iters
#Create DXF of Envelope Results
print 'Creating DXF of Results ...'
print ('Creating DXF of Results ...')
file = open(os.path.join(path,bmlabel+'_02_Envelope_Results.dxf'),'w')
file.write(' 0\nSECTION\n 2\nENTITIES\n')
file.write(' 0\nPOLYLINE\n 8\nspans\n 66\n1\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 70\n8\n')
Expand Down Expand Up @@ -3349,7 +3348,7 @@ def run_file(self):
file.write(' 0\nENDSEC\n 0\nEOF')
file.close()

print 'Done!'
print ('Done!')
self.brun.configure(bg='green')
self.bresults.configure(state="normal", bg='green')
self.menu.entryconfig(4, state="normal")
Expand Down
1 change: 0 additions & 1 deletion Analysis/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import scipy as sci
import scipy.integrate
import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions Analysis/load_combo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@

max_ind = np.unravel_index(np.argmax(combined), combined.shape)

print basic_combos[max_ind[0]]
print xs[max_ind[1]]
print (basic_combos[max_ind[0]])
print (xs[max_ind[1]])

max_flat = np.max(combined, axis=0).reshape(501,1)
min_flat = np.min(combined, axis=0).reshape(501,1)
Expand Down
1 change: 0 additions & 1 deletion Analysis/pin_pin_beam_equations_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
from numpy import sign
from numpy import zeros
import numpy as np
Expand Down
9 changes: 4 additions & 5 deletions Analysis/simple_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import Tkinter as tk
import ttk
import tkFont
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.font as tkFont
import pin_pin_beam_equations_classes as ppbeam
from numpy import zeros
import numpy as np
import scipy.integrate as sci_int
import math
import os
import webbrowser
import tkMessageBox
import tkinter.messagebox as tkMessageBox
# import matplotlib.pyplot as plt

class Master_window:
Expand Down
4 changes: 2 additions & 2 deletions Analysis/testing_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@
results_3mm = test_3mm.res()


print 'Analysis: {0}'.format(analysis_time)
print 'Analysis - 3mm: {0}'.format(analysis_3mm_time)
print ('Analysis: {0}'.format(analysis_time))
print ('Analysis - 3mm: {0}'.format(analysis_3mm_time))
1 change: 0 additions & 1 deletion Analysis/three_moment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import numpy as np
from numpy.linalg import inv
import scipy as sci
Expand Down
1 change: 0 additions & 1 deletion Analysis/three_moment_method_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import numpy as np
from numpy.linalg import inv
import scipy as sci
Expand Down
7 changes: 3 additions & 4 deletions Code/line_helper_gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -14,8 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import Tkinter as tk
import tkinter as tk


class Main_window:
Expand Down Expand Up @@ -173,4 +172,4 @@ def main():
root.mainloop()

if __name__ == '__main__':
main()
main()
17 changes: 8 additions & 9 deletions Code/snow_drift by polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import math
import numpy as np
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -646,16 +645,16 @@ def line_closest_to_point_and_point_on_line(point, lines):
calc_log, perp_lines, intersect_points, points_x, points_y = drift_all(lines,snow_density_pcf,pg_psf,25,1)

s_x, s_y, mx, my = lines_transformation_to_origin(lines)
print s_x
print s_y
print mx
print my
print (s_x)
print (s_y)
print (mx)
print (my)

test1, test2, segment, segment_point = line_closest_to_point_and_point_on_line([35.5,9.4],lines)
print test1
print test2
print segment
print segment_point
print (test1)
print (test2)
print (segment)
print (segment_point)

colors = ['r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k']
i=0
Expand Down
17 changes: 8 additions & 9 deletions Code/snow_drift_by_polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import math
import numpy as np
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -712,16 +711,16 @@ def export_dxf(path, lines):
calc_log, perp_lines, intersect_points, points_x, points_y = drift_all(lines,snow_density_pcf,pg_psf,25,1)

s_x, s_y, mx, my = lines_transformation_to_origin(lines)
print s_x
print s_y
print mx
print my
print (s_x)
print (s_y)
print (mx)
print (my)

test1, test2, segment, segment_point = line_closest_to_point_and_point_on_line([35.5,9.4],lines)
print test1
print test2
print segment
print segment_point
print (test1)
print (test2)
print (segment)
print (segment_point)

colors = ['r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k','r','b','g','c','m','y','k']
i=0
Expand Down
11 changes: 5 additions & 6 deletions Code/snow_drift_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from __future__ import division
import math as m
import Tkinter as tk
import tkMessageBox
import ttk
import tkFont
import tkFileDialog
import tkinter as tk
import tkinter.messagebox as tkMessageBox
import tkinter.ttk as ttk
import tkinter.font as tkFont
import tkinter.filedialog as tkFileDialog
import snow_drift_by_polygons as snow_drift

class main_window:
Expand Down
Loading