Skip to content

Commit

Permalink
modified tutorial to the new commits
Browse files Browse the repository at this point in the history
  • Loading branch information
hzarei4 committed Jul 15, 2024
1 parent 133ca00 commit 76b7d14
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
DataToFunctions = "64cfdffa-4d02-49ee-ae8b-a805370874f5"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SyntheticObjects = "e7028c27-0967-45e9-8fdb-dbc10ccb2b0a"
12 changes: 9 additions & 3 deletions docs/src/tutorial.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Tutorial for the DataToFunctions.jl package

import Pkg
Pkg.add("SyntheticObjects")
Pkg.add("StaticArrays")
Pkg.add("Plots")
Pkg.add("Random")

# Load the packages
using DataToFunctions
using SyntheticObjects
Expand Down Expand Up @@ -42,13 +48,13 @@ heatmap(data_transformed_m, aspect_ratio=1

# Now we try to do the transformation using a polynomial function
# we first define the interpolation object using the DataToFunctions package with a polynomial of order 1
f_polynomial = get_function_polynomial(data, 1)
f_polynomial = get_function_poly(data, 1)

# define the polynomial coefficients
params = [1.0, 0.0, 1.0, 0.0, 1.0, 0.0]
params = (1.0, 0.0, 1.0, 0.0, 1.0, 0.0)

# apply the transformation
data_transformed_polynomial = f_polynomial(params)
data_transformed_polynomial = f_polynomial((params))

heatmap(data_transformed_polynomial, aspect_ratio=1
, title="Transformed data using a polynomial function of order 1"
Expand Down
14 changes: 11 additions & 3 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ EditURL = "tutorial.jl"

Tutorial for the DataToFunctions.jl package

````@example tutorial
import Pkg
Pkg.add("SyntheticObjects")
Pkg.add("StaticArrays")
Pkg.add("Plots")
Pkg.add("Random")
````

Load the packages

````@example tutorial
Expand Down Expand Up @@ -65,19 +73,19 @@ Now we try to do the transformation using a polynomial function
we first define the interpolation object using the DataToFunctions package with a polynomial of order 1

````@example tutorial
f_polynomial = get_function_polynomial(data, 1)
f_polynomial = get_function_poly(data, 1)
````

define the polynomial coefficients

````@example tutorial
params = [1.0, 0.0, 1.0, 0.0, 1.0, 0.0]
params = (1.0, 0.0, 1.0, 0.0, 1.0, 0.0)
````

apply the transformation

````@example tutorial
data_transformed_polynomial = f_polynomial(params)
data_transformed_polynomial = f_polynomial((params))
heatmap(data_transformed_polynomial, aspect_ratio=1
, title="Transformed data using a polynomial function of order 1"
Expand Down
4 changes: 2 additions & 2 deletions examples/deform_testimage.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.19.43
# v0.19.42

using Markdown
using InteractiveUtils
Expand Down Expand Up @@ -87,7 +87,7 @@ h = get_function_poly(data, 1)
@bind c6 Slider(-2f0:0.05f0:2f0, default=1)

# ╔═╡ 74228a9d-6cc2-4aaf-97da-67f32670341e
Gray.(h((c1,c2,c3,c4,c5,c6,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0)))
Gray.(h((0f0, 0f0, 1.0f0, 0f0, 1.00f0, 0f0)))#,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0)))

# ╔═╡ 687a198b-9020-4959-8e27-fd0896d4b1fc
maximum(h((c1,c2,c3,c4,c5,c6,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0,0f0)))
Expand Down

0 comments on commit 76b7d14

Please sign in to comment.