Skip to content
Snippets Groups Projects
Commit 0fa445f3 authored by Jain, Adavita's avatar Jain, Adavita
Browse files

Merge branch '1-create-docker-image-for-fractal' into 'main'

Resolve "Create docker image for fractal tool"

Closes #1

See merge request !1
parents c5a91649 82f871fd
No related branches found
No related tags found
1 merge request!1Resolve "Create docker image for fractal tool"
Pipeline #395562 skipped with stage
# this sets the base image as ubuntu:20.04
FROM ubuntu:20.04
# this will install the tzdata package and set the environment variable to prevent any interactive prompts during
# installation
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata
# the lines below will install and update python3 and pip and clean the package cache to reduce the image cache
RUN apt-get update \
&& apt-get install -y \
python3 \
python3-pip \
&& apt-get clean
RUN pip3 install scipy numpy matplotlib
# uses pip3 to install the necessary packages
RUN pip3 install pyfracgen numpy==1.23.5 matplotlib argparse pathlib
# copies everything from the local src directory (which contains the python file) to the image's src file
COPY /src /src
import pyfracgen as pf
from matplotlib import pyplot as plt
import argparse
import numpy as np
import itertools as itt
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--option", type=str, required=True)
args = parser.parse_args()
xbound = (0.3602404434376143632361252444495 - 0.00000000000003,
0.3602404434376143632361252444495 + 0.00000000000025)
ybound = (-0.6413130610648031748603750151793 - 0.00000000000006,
-0.6413130610648031748603750151793 + 0.00000000000013)
if args.option == "mandelbrot":
xbound = (
0.3602404434376143632361252444495 - 0.00000000000003,
0.3602404434376143632361252444495 + 0.00000000000025,
)
ybound = (
-0.6413130610648031748603750151793 - 0.00000000000006,
-0.6413130610648031748603750151793 + 0.00000000000013,
)
res = pf.mandelbrot(
xbound, ybound, pf.funcs.power, width=4, height=3, dpi=300, maxiter=5000
)
stacked = pf.images.get_stacked_cmap(plt.cm.gist_gray, 50)
pf.images.image(res, cmap=stacked, gamma=0.8)
plt.savefig("data.png")
elif args.option == "julia":
reals = itt.chain(np.linspace(-1, 2, 60)[0:-1], np.linspace(2, 3, 40))
series = pf.julia(
(complex(real, 0.75) for real in reals),
xbound=(-1, 1),
ybound=(-0.75, 1.25),
update_func=pf.funcs.magnetic_2,
maxiter=300,
width=5,
height=4,
dpi=200,
)
pf.images.save_animation(
list(series),
cmap=plt.cm.ocean,
gamma=0.6,
file=Path("data"),
)
elif args.option == "random":
basis = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
moves = pf.construct_moves(basis)
res = pf.randomwalk(moves, niter=5000000, width=4, height=3, depth=10, dpi=300)
pf.images.randomwalk_image(res, cmap=plt.cm.gist_yarg, gamma=1.0)
plt.savefig("data.png")
elif args.option == "markus":
string = "AAAAAABBBBBB"
xbound = (2.5, 3.4)
ybound = (3.4, 4.0)
res = pf.lyapunov(
string, xbound, ybound, width=4, height=3, dpi=300, ninit=2000, niter=2000
)
pf.images.markus_lyapunov_image(res, plt.cm.bone, plt.cm.bone_r, gammas=(8, 1))
plt.savefig("data.png")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment