Commit bb8b4969 authored by Bognár, Á.'s avatar Bognár, Á.
Browse files

add .gitignore

parent e791eba9
# files
# build
# docs
This is the Daypym Package.
# print('Daypym init happens')
......@@ -168,6 +168,23 @@ def point_in_poly(point, poly):
no_inter_d = len(inter_d[0])
return True if no_inter_r == 3 or no_inter_l == 3 or no_inter_u == 3 or no_inter_d == 3 else False # we will see how robust this is # check this again later
def supress_points(xyz, vertices, zmax, apothem):
"""Return an xyz with the points supressed to zmax within the vertices of
the polygon. This is to use with a cropped xyz made with tiff2xyz()."""
vert_vects = [Vector2D(v[0]-apothem, v[1]-apothem) for v in vertices]
poly = Polygon2D(vert_vects)
x_min = min(poly.xs)
x_max = max(poly.xs)
y_min = min(poly.ys)
y_max = max(poly.ys)
for i in xyz.index:
if ((xyz.loc[i, 'x'] > x_min and xyz.loc[i, 'x'] < x_max) and
(xyz.loc[i, 'y'] > y_min and xyz.loc[i, 'y'] < y_max)):
point = Vector2D(xyz.loc[i, 'x'], xyz.loc[i, 'y'])
if point_in_poly(point, poly):
xyz.loc[i, 'z'] = zmax
return xyz
def gridpoints_in_poly_2d(grid_2d, poly_2d):
"Returns a list of points, that are inside a 2d poly. Takes a meshgrid (made with grid_2d) and a 2d poly as input"
pip = [] # list of points in poly
......@@ -232,6 +249,16 @@ def create_sensor_points(surf_name, points_in_poly_2d, row_index, col_index, ori
sensor_points_surf = {'surf_name':surf_name, 'surf_coords':original_poly.vertices_list, 'sensor_points':sensor_points, 'ri':row_index, 'ci':col_index, 'sp_ori':list(normal_vectors)} # make a dict for the sensor points with name points and vectors, later export this to DS file
return sensor_points_surf
def xyz_coords_from_sps(sps):
"""Takes sps dict as input. Extracts x, y, z coords from an sps dict made
with the create_sensor_points() or the pointgrid_over_surface() function"""
x, y, z = ([] for i in list(range(3)))
for p in sps:
x += [c[0] for c in p['sensor_points']]
y += [c[1] for c in p['sensor_points']]
z += [c[2] for c in p['sensor_points']]
return pd.DataFrame(data={'x':x, 'y':y, 'z':z})
def translate_to_ds_pts(surf_sensor_points, p_name, grid_method):
"""Translates and saves the sensorpoints as Daysim .pts file. Also saves a csv or json with additional info useful for postprocessing"""
x, y, z, vx, vy, vz, surf_name, ri, ci = ([] for i in list(range(9)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment