Skip to content

Commit a8bdd50

Browse files
committed
deprecated Requires
1 parent 18fe7c9 commit a8bdd50

File tree

10 files changed

+226
-105
lines changed

10 files changed

+226
-105
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ environment:
33
- julia_version: 1
44
- julia_version: 1.6
55
- julia_version: 1.10
6+
- julia_version: 1.11
67
- julia_version: nightly
78

89
platform:

CITATION.cff

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- family-names: "Reed"
5+
given-names: "Michael"
6+
orcid: "https://orcid.org/0000-0002-8006-7816"
7+
title: "Fatou.jl"
8+
version: 1.2.1
9+
doi: 10.5281/zenodo.10670459
10+
date-released: 2024-02-16
11+
url: "https://github.com/chakravala/Fatou.jl"

Project.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Fatou"
22
uuid = "5f923234-c850-556d-bb4f-28324fa1959a"
33
authors = ["Michael Reed"]
4-
version = "1.2.1"
4+
version = "1.2.2"
55

66
[deps]
77
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
@@ -10,6 +10,20 @@ SyntaxTree = "a4af3ec5-f8ac-5fed-a759-c2e80b4d74cb"
1010
Reduce = "93e0c654-6965-5f22-aba9-9c1ae6b3c259"
1111
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1212

13+
[weakdeps]
14+
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
15+
#Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
16+
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
17+
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
18+
Grassmann = "4df31cd9-4c27-5bea-88d0-e6a7146666d8"
19+
20+
[extensions]
21+
ImageInTerminalExt = "ImageInTerminal"
22+
#MakieExt = "Makie"
23+
PyPlotExt = "PyPlot"
24+
UnicodePlotsExt = "UnicodePlots"
25+
GrassmannExt = "Grassmann"
26+
1327
[compat]
1428
julia = "1"
1529
Reduce = "1.2.13"

ext/GrassmannExt.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module GrassmannExt
2+
3+
# This file is part of Fatou.jl.
4+
# It is licensed under the MIT license
5+
# Copyright (C) 2017 Michael Reed
6+
# _ _ _
7+
# | | | | | |
8+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
9+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
10+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
11+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
12+
#
13+
# https://github.com/chakravala
14+
# https://crucialflow.com
15+
16+
using Fatou
17+
isdefined(Fatou, :Requires) ? (import Fatou: Grassmann) : (using Grassmann)
18+
19+
function Fatou.orbit(K::Fatou.Define{FT,QT,CT,M,N,P,D,B},Z0::Complex{Float64}) where {FT,QT,CT,M,N,P,D,B}
20+
V = Grassmann.Manifold(B)
21+
z0 = Grassmann.Couple{V,B}(Z0)
22+
M ? (z = Grassmann.Couple{V,B}(K.seed)) : (z = P ? Grassmann.Couple{V,B}(Fatou.plane(Z0)) : z0)
23+
zn = 0x0000
24+
while (N ? (Grassmann.value(K.Q(z,z0))::Float64>K.ϵ)::Bool : (Grassmann.value(K.Q(z,z0))::Float64<K.ϵ))::Bool && K.N>zn
25+
z = K.F(z,z0)::Grassmann.Couple{V,B,Float64}
26+
zn+=0x0001
27+
end; #end
28+
# return the normalized argument of z or iteration count
29+
return (zn::UInt16,(D ? Fatou.disk(Grassmann.value(z)) : Grassmann.value(z))::Complex{Float64})
30+
end
31+
32+
end # module

ext/ImageInTerminalExt.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module ImageInTerminalExt
2+
3+
# This file is part of Fatou.jl.
4+
# It is licensed under the MIT license
5+
# Copyright (C) 2017 Michael Reed
6+
# _ _ _
7+
# | | | | | |
8+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
9+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
10+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
11+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
12+
#
13+
# https://github.com/chakravala
14+
# https://crucialflow.com
15+
16+
using Fatou
17+
isdefined(Fatou, :Requires) ? (import Fatou: ImageInTerminal) : (using ImageInTerminal)
18+
19+
import Fatou: ColorSchemes
20+
function Base.show(io::IO,K::Fatou.FilledSet;c::String="",bare::Bool=false)
21+
isempty(c) && (c = K.meta.cmap)
22+
display(getproperty(ColorSchemes, isempty(c) ? :balance : Symbol(c))(K))
23+
!bare && print(io,String(K))
24+
end
25+
26+
end # module
File renamed without changes.

ext/PyPlotExt.jl

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
module PyPlotExt
2+
3+
# This file is part of Fatou.jl.
4+
# It is licensed under the MIT license
5+
# Copyright (C) 2019 Michael Reed
6+
# _ _ _
7+
# | | | | | |
8+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
9+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
10+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
11+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
12+
#
13+
# https://github.com/chakravala
14+
# https://crucialflow.com
15+
16+
using Fatou
17+
isdefined(Fatou, :Requires) ? (import Fatou: PyPlot) : (using PyPlot)
18+
19+
PyPlot.plot(K::Fatou.FilledSet;c::String="",bare::Bool=false) = PyPlot.imshow(K;cmap=c,bare=bare)
20+
21+
function PyPlot.imshow(K::Fatou.FilledSet;cmap::String="",bare::Bool=false)
22+
PyPlot.figure() # plot figure using imshow based in input preferences
23+
isempty(cmap) && (cmap = K.meta.cmap)
24+
isempty(cmap) ? PyPlot.imshow(K.meta.iter ? K.iter : K.mix, extent=Fatou.bounds(K)) :
25+
PyPlot.imshow(K.meta.iter ? K.iter : K.mix, cmap=cmap, extent=Fatou.bounds(K))
26+
PyPlot.tight_layout()
27+
!bare && PyPlot.title(K)
28+
end
29+
30+
function PyPlot.title(K::Fatou.FilledSet) # annotate title using LaTeX
31+
text,t = "f:z\\mapsto $(rdpm(Fatou.Algebra.latex(K.meta.E))),\\,",Fatou.LaTeXString(Fatou.typeplot(K))
32+
if K.meta.newt # annotate y-axis with Newton's method
33+
PyPlot.title(Fatou.latexstring("$text m = $(K.meta.m), ")*t)
34+
PyPlot.ylabel(Fatou.L"Fatou\,set:\,"*L"z\,\,z-m\,×\,f(z)\,/\,f\,'(z)")
35+
else
36+
PyPlot.title(Fatou.latexstring(text)*t)
37+
end
38+
PyPlot.tight_layout()
39+
PyPlot.colorbar()
40+
end
41+
42+
function orbit(E,f::Function,bi::Matrix{Float64},orb::Int=0,depth::Int=1,incr::Int=384)
43+
x,N,N2,orbit,bis = Fatou.real_orb(E,f,bi,orb,depth,incr)
44+
# prepare for next figure
45+
PyPlot.figure()
46+
# plot background lines
47+
PyPlot.plot(x[:],N[:,1],"k--",x[:],N[:,2])
48+
# plot orbit cobweb path
49+
PyPlot.plot(orbit[:,1],orbit[:,2],"r")
50+
# plot f^2,f^3,f^4,...
51+
for h 3:depth+1
52+
PyPlot.plot(x,N[:,h],lw=1)
53+
end
54+
if ~(orb == 0)
55+
PyPlot.plot(range(bi[1],stop=bi[2],length=length(N2)),N2[:],"gray",marker="x",linestyle=":",lw=1)
56+
funs = [Fatou.latexstring("\\phi(x_{0:$orb})")]
57+
funt = ", IC: \$ x_0 = $(bis[3])\$, \$ n\\in0:$orb\$"
58+
else
59+
funs = []
60+
funt = ""
61+
end
62+
# trim graph
63+
d=1.07
64+
PyPlot.xlim(bi[1],bi[2])
65+
PyPlot.ylim(minimum([d*minimum(N[:,2]),0]),maximum([d*maximum(N[:,2]),0]))
66+
# set title
67+
fune = rdpm(Fatou.Algebra.latex(E))
68+
PyPlot.title(Fatou.latexstring("\$ x \\mapsto $fune\$$funt"))
69+
# set legend
70+
PyPlot.legend(vcat([Fatou.L"$y=x$",L"$\phi(x)$",L"(x_n,\phi(x_n))"],[Fatou.latexstring("\\phi^{$x}(x)") for x 2:depth],funs))
71+
PyPlot.tight_layout()
72+
return
73+
end
74+
75+
end # module

src/uniplots.jl renamed to ext/UnicodePlotsExt.jl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
# This file is part of Fatou.jl. It is licensed under the MIT license
1+
module UnicodePlotsExt
2+
3+
# This file is part of Fatou.jl.
4+
# It is licensed under the MIT license
25
# Copyright (C) 2019 Michael Reed
6+
# _ _ _
7+
# | | | | | |
8+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
9+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
10+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
11+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
12+
#
13+
# https://github.com/chakravala
14+
# https://crucialflow.com
15+
16+
using Fatou
17+
isdefined(Fatou, :Requires) ? (import Fatou: UnicodePlots) : (using UnicodePlots)
318

4-
function orbit(E,f::Function,bi::Matrix{Float64},orb::Int=0,depth::Int=1,incr::Int=384)
5-
x,N,N2,orbit,bis = real_orb(E,f,bi,orb,depth,incr)
19+
function Fatou.orbit(E,f::Function,bi::Matrix{Float64},orb::Int=0,depth::Int=1,incr::Int=384)
20+
x,N,N2,orbit,bis = Fatou.real_orb(E,f,bi,orb,depth,incr)
621
# trim graph
722
d=1.07
823
xl = bi[1:2]
@@ -28,3 +43,5 @@ function orbit(E,f::Function,bi::Matrix{Float64},orb::Int=0,depth::Int=1,incr::I
2843
UnicodePlots.title!(plt,"z ↦ $E$funt")
2944
return plt
3045
end
46+
47+
end # module

src/Fatou.jl

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
module Fatou
2-
using SyntaxTree,Reduce,LaTeXStrings,Requires,Base.Threads
2+
using SyntaxTree, Reduce, LaTeXStrings, Base.Threads
33

4-
# This file is part of Fatou.jl. It is licensed under the MIT license
4+
# This file is part of Fatou.jl.
5+
# It is licensed under the MIT license
56
# Copyright (C) 2017 Michael Reed
7+
# _ _ _
8+
# | | | | | |
9+
# ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _
10+
# / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` |
11+
# | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| |
12+
# \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
13+
#
14+
# https://github.com/chakravala
15+
# https://crucialflow.com
16+
# _________ ____ ________ ____ __ __
17+
# (_ _____) ( ) (___ ___) / __ \ ) ) ( (
18+
# ) (___ / /\ \ ) ) / / \ \ ( ( ) )
19+
# ( ___) ( (__) ) ( ( ( () () ) ) ) ( (
20+
# ) ( ) ( ) ) ( () () ) ( ( ) )
21+
# ( ) / /\ \ ( ( \ \__/ / ) \__/ (
22+
# \_/ /__( )__\ /__\ \____/ \______/
623

724
export fatou, juliafill, mandelbrot, newton, basin, plot
825

@@ -353,50 +370,36 @@ function Base.String(K::FilledSet) # annotate title using LaTeX
353370
K.meta.newt ? "$text m = $(K.meta.m), $t" : "$text $t"
354371
end
355372

356-
function __init__()
357-
println("Fatou detected $(Threads.nthreads()) julia threads.")
358-
@require ColorSchemes="35d6a980-a343-548e-a6ea-1d62b119f2f4" begin
359-
nonan(x) = isnan(x) ? 0.0 : x
360-
function (C::ColorSchemes.ColorScheme)(K::FilledSet)
361-
S = size(K.iter)
362-
H = zeros(ColorSchemes.RGB{Float64},S...)
363-
if K.meta.iter
364-
M = length(C)/(maximum(K.iter)+1)
365-
for x 1:S[1], y 1:S[2]
366-
H[x,y] = C[round(Int,M*(K.iter[x,y]+1),RoundUp)]
367-
end
368-
else
369-
for x 1:S[1], y 1:S[2]
370-
H[x,y] = get(C,nonan(K.mix[x,y]))
371-
end
372-
end
373-
return H
373+
import ColorSchemes
374+
nonan(x) = isnan(x) ? 0.0 : x
375+
function (C::ColorSchemes.ColorScheme)(K::Fatou.FilledSet)
376+
S = size(K.iter)
377+
H = zeros(ColorSchemes.RGB{Float64},S...)
378+
if K.meta.iter
379+
M = length(C)/(maximum(K.iter)+1)
380+
for x 1:S[1], y 1:S[2]
381+
H[x,y] = C[round(Int,M*(K.iter[x,y]+1),RoundUp)]
374382
end
375-
end
376-
@require ImageInTerminal="d8c32880-2388-543b-8c61-d9f865259254" begin
377-
import ColorSchemes
378-
function Base.show(io::IO,K::FilledSet;c::String="",bare::Bool=false)
379-
isempty(c) && (c = K.meta.cmap)
380-
display(getproperty(ColorSchemes, isempty(c) ? :balance : Symbol(c))(K))
381-
!bare && print(io,String(K))
383+
else
384+
for x 1:S[1], y 1:S[2]
385+
H[x,y] = get(C,nonan(K.mix[x,y]))
382386
end
383387
end
384-
@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("makie.jl")
385-
@require PyPlot="d330b81b-6aea-500a-939a-2ce795aea3ee" include("pyplot.jl")
386-
@require UnicodePlots="b8865327-cd53-5732-bb35-84acbb429228" include("uniplots.jl")
387-
@require Grassmann="4df31cd9-4c27-5bea-88d0-e6a7146666d8" begin
388-
function orbit(K::Define{FT,QT,CT,M,N,P,D,B},Z0::Complex{Float64}) where {FT,QT,CT,M,N,P,D,B}
389-
V = Grassmann.Manifold(B)
390-
z0 = Grassmann.Couple{V,B}(Z0)
391-
M ? (z = Grassmann.Couple{V,B}(K.seed)) : (z = P ? Grassmann.Couple{V,B}(plane(Z0)) : z0)
392-
zn = 0x0000
393-
while (N ? (Grassmann.value(K.Q(z,z0))::Float64>K.ϵ)::Bool : (Grassmann.value(K.Q(z,z0))::Float64<K.ϵ))::Bool && K.N>zn
394-
z = K.F(z,z0)::Grassmann.Couple{V,B,Float64}
395-
zn+=0x0001
396-
end; #end
397-
# return the normalized argument of z or iteration count
398-
return (zn::UInt16,(D ? disk(Grassmann.value(z)) : Grassmann.value(z))::Complex{Float64})
399-
end
388+
return H
389+
end
390+
391+
if !isdefined(Base, :get_extension)
392+
using Requires
393+
end
394+
395+
function __init__()
396+
println("Fatou detected $(Threads.nthreads()) julia threads.")
397+
@static if !isdefined(Base, :get_extension)
398+
@require ImageInTerminal="d8c32880-2388-543b-8c61-d9f865259254" include("../ext/ImageInTerminalExt.jl")
399+
#@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("../ext/MakieExt.jl")
400+
@require PyPlot="d330b81b-6aea-500a-939a-2ce795aea3ee" include("../ext/PyPlotExt.jl")
401+
@require UnicodePlots="b8865327-cd53-5732-bb35-84acbb429228" include("../ext/UnicodePlotsExt.jl")
402+
@require Grassmann="4df31cd9-4c27-5bea-88d0-e6a7146666d8" include("../ext/GrassmannExt.jl")
400403
end
401404
end
402405

src/pyplot.jl

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)