Dear Experts,
I was looking for the way to make 2D interpolation based on two input values (Qb/Qc, Ab/Ac):
I.e.:
Qb/Qc = 0.285
Ab/Ac = 0.303
Result: 0.88
Dear Experts,
I was looking for the way to make 2D interpolation based on two input values (Qb/Qc, Ab/Ac):
I.e.:
Qb/Qc = 0.285
Ab/Ac = 0.303
Result: 0.88
@kvusal ,
i found just python stuff
https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html
KR
Andreas
I think its possible with just Dynamo too. Something like that:
Lets say this is the list with the positions, by the given example all the Q and A values:
The matrix is a list of lists so it’s easy to represent in a simple way in Dynamo. You round the numbers and get the closest value for both positions, while you also define a multiplier like that:
In the end, you get the two indexes, you can use them to get the value from a second matrix and apply the multiplier.
I haven’t had time to validate the logic, but I think it should work at least as a general concept
EDIT: I actually think the logic is ok, but the multiplier formula should be a bit different:
Home.dyn (26.6 KB)
Hello, here is a possibility
(Data must exist in csv format)
List_Polycurve=IN[0]
OUT = [[List_Polycurve[i],List_Polycurve[i+1]] for i in range(0,len(List_Polycurve)-1)]
Cordially
christian.stan
wow, turning the matrix into a surface and simply getting a point’s Z value, brilliant !
Thanks,here’s the dot matrix (now my eyes hurt with this data, time to bask )
and the complete script.
a=1..9;
[a,a,a,a,a,a,a,a,a];
[[0.73,0.34,0.32,0.34,0.35,0.37,0.38,0.39,0.40],
[3.10,0.73,0.41,0.34,0.34,0.32,0.32,0.33,0.34,0.35],
[7.59,1.65,0.73,0.47,0.37,0.34,0.32,0.32,0.32],
[14.2,3.1,1.28,0.73,0.51,0.41,0.36,0.34,0.32],
[22.92,5.08,2.07,1.12,0.73,0.54,0.44,0.38,0.35],
[33.76,7.59,3.1,1.65,1.03,0.73,0.56,0.47,0.41],
[46.71,10.63,4.36,2.31,1.42,0.98,0.73,0.58,0.49],
[61.79,14.2,5.86,3.1,1.9,1.28,0.94,0.73,0.6],
[78.98,18.29,7.59,4.02,2.46,1.65,1.19,0.91,0.73]];
24 Mai Forum anglais.dyn (23.9 KB)
Good evening
edit: She has a funny look this surface
Cordially
christian.stan
Dear Cristian,
is it possible to adopt mentioned script to this input:
Hi,
The matrix only enlarges, so normally no impediment
From a PDF read the data to create the matrix, Mr. @c.poupin, may have already done this kind of thing, on occasion he will answer you.
Sincerely
christian.stan
Thanks for prompt feedback.
I could not able to create list for mentioned matrix
What can be reason?
Hi,
to extract table data from image you can use as example
ExtractTable - convert image to excel, extract tables from PDF
once the data is obtained (e.g. csv), for interpolation with a 2d array, we can use pandas and scipy.interpolate.griddata
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import pandas as pd
import scipy
from scipy.interpolate import griddata
csv_path = IN[0]
row_value = IN[1]
column_value = IN[2]
#load a csv file into a dataframe using pandas
df = pd.read_csv(csv_path)
# set the index of the dataframe as the "Ab_Ac" column
df = df.set_index('Ab_Ac')
#This code creates a list of tuples for each index and column in the dataframe
index_column_tuples = [(index, col) for index in df.index for col in df.columns]
# create a list of values by iterating through the index_column_tuples list
# and appending the value at that index and column in the dataframe
values = [float(df.at[row, col]) for row, col in index_column_tuples]
# create a list of index_column values by iterating through the index_column_tuples list
# and appending the index and column values as floats
index_column_values = [[float(i), float(j)] for i , j in index_column_tuples]
# uses the griddata function from scipy to interpolate the data at the index_column values
test = griddata(index_column_values, values, (row_value, column_value) )
#This line of code outputs the dataframe and the interpolated value
OUT = repr(df), float(test)
Dear Christian,
it seems great solution. But today i realized that this solution is not working on the negative Z values of surface. What kind of revision we can do in order to get result?
Thanks in advance.
Negative Z Value Error.dyn (29.9 KB)
Create Approach. Many thanks.