Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
trevormccaffrey committed Jun 16, 2021
1 parent 88d6a7f commit e6a8c8b
Show file tree
Hide file tree
Showing 12 changed files with 1,843 additions and 25 deletions.
Binary file added .DS_Store
Binary file not shown.
919 changes: 919 additions & 0 deletions .ipynb_checkpoints/example-Copy1-checkpoint.ipynb

Large diffs are not rendered by default.

534 changes: 534 additions & 0 deletions .ipynb_checkpoints/example-Copy2-checkpoint.ipynb

Large diffs are not rendered by default.

202 changes: 192 additions & 10 deletions .ipynb_checkpoints/example-checkpoint.ipynb

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions CIVfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def project(data, fit):
return np.array(locs)


def CIV_distance(data_original, fit_original):
def CIV_distance(data_original, fit_original, step=1):
#fit: N-by-2 array containing coordinates of points along best fit line
#data: N-by-2 [[x,y]] array of data
#NOTE: This really just caters to this situation (assumes monotonically decreasing fit_original)
Expand All @@ -38,12 +38,13 @@ def CIV_distance(data_original, fit_original):
#3) Loop through each data point- start at tip of line and sum dist traveled until passing data point
for scat in data:
d = 0 #start at beginning of the line
for i in range(fit.shape[0]-1):
xp, x = fit[i,0], fit[i+1,0]
yp, y = fit[i,1], fit[i+1,1]
for i in range(0, fit.shape[0]-step, step):
xp, x = fit[i,0], fit[i+step,0]
yp, y = fit[i,1], fit[i+step,1]
dp = d
d += np.sqrt((x-xp)**2 + (y-yp)**2)
if yp >= scat[1] > y: #if we pass the projected y-coord, save the distance traveled
darr.append(d)
darr.append((d+dp)/2) #save the average between dprevious and d
break

return np.array(darr)
Binary file modified __pycache__/CIVfunctions.cpython-36.pyc
Binary file not shown.
Binary file added data/.DS_Store
Binary file not shown.
202 changes: 192 additions & 10 deletions example.ipynb

Large diffs are not rendered by default.

Binary file added imgs/.DS_Store
Binary file not shown.
Binary file added imgs/distance_path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/project_scaled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/scale_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e6a8c8b

Please sign in to comment.