kececifractals 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kececifractals-0.1.0/LICENSE +21 -0
- kececifractals-0.1.0/MANIFEST.in +3 -0
- kececifractals-0.1.0/PKG-INFO +228 -0
- kececifractals-0.1.0/README.md +196 -0
- kececifractals-0.1.0/kececifractals/__init__.py +37 -0
- kececifractals-0.1.0/kececifractals/_version.py +9 -0
- kececifractals-0.1.0/kececifractals/kececifractals.py +272 -0
- kececifractals-0.1.0/kececifractals.egg-info/PKG-INFO +228 -0
- kececifractals-0.1.0/kececifractals.egg-info/SOURCES.txt +15 -0
- kececifractals-0.1.0/kececifractals.egg-info/dependency_links.txt +1 -0
- kececifractals-0.1.0/kececifractals.egg-info/requires.txt +2 -0
- kececifractals-0.1.0/kececifractals.egg-info/top_level.txt +1 -0
- kececifractals-0.1.0/pyproject.toml +3 -0
- kececifractals-0.1.0/setup.cfg +4 -0
- kececifractals-0.1.0/setup.py +30 -0
- kececifractals-0.1.0/tests/test_sample.py +2 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mehmet Keçeci
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kececifractals
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: eçeci Fractals: Keçeci-style circle fractal.
|
|
5
|
+
Home-page: https://github.com/WhiteSymmetry/kececifractals
|
|
6
|
+
Author: Mehmet Keçeci
|
|
7
|
+
Author-email: bilginomi@yaani.com
|
|
8
|
+
Maintainer: Mehmet Keçeci
|
|
9
|
+
Maintainer-email: bilginomi@yaani.com
|
|
10
|
+
License: MIT
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: maintainer
|
|
28
|
+
Dynamic: maintainer-email
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# Keçeci Fractals: Keçeci Fraktals
|
|
34
|
+
|
|
35
|
+
Keçeci Circle Fractal: Keçeci-style circle fractal.
|
|
36
|
+
|
|
37
|
+
[](https://badge.fury.io/py/kececifractals)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
|
|
40
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
41
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
42
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
43
|
+
|
|
44
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
45
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
46
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
47
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
48
|
+
|
|
49
|
+
[](https://opensource.org/)
|
|
50
|
+
[](https://kececifractals.readthedocs.io/en/latest)
|
|
51
|
+
|
|
52
|
+
[](https://www.bestpractices.dev/projects/)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Description / Açıklama
|
|
57
|
+
|
|
58
|
+
**Keçeci Circle Fractal: Keçeci-style circle fractal.**:
|
|
59
|
+
|
|
60
|
+
Many systems encountered in nature and engineering exhibit complex and hierarchical geometric structures. Fractal geometry provides a powerful tool for understanding and modeling these structures. However, existing deterministic circle packing fractals, such as the Apollonian gasket, often adhere to fixed geometric rules and may fall short in accurately reflecting the diversity of observed structures. Addressing the need for greater flexibility in modeling physical and mathematical systems, this paper introduces the Keçeci Circle Fractal (KCF), a novel deterministic fractal. The KCF is generated through a recursive algorithm where a parent circle contains child circles scaled down by a specific `scale_factor` and whose number (`initial_children`, `recursive_children`) is controllable. These parameters allow for the tuning of the fractal's morphological characteristics (e.g., density, void distribution, boundary complexity) over a wide range. The primary advantage of the KCF lies in its tunable geometry, enabling more realistic modeling of diverse systems with varying structural parameters, such as porous media (for fluid flow simulations), granular material packings, foam structures, or potentially biological aggregations. Furthermore, the controllable structure of the KCF provides an ideal testbed for investigating structure-dependent physical phenomena like wave scattering, heat transfer, or electrical conductivity. Mathematically, it offers opportunities to study variations in fractal dimension and packing efficiency for different parameter values. In conclusion, the Keçeci Circle Fractal emerges as a valuable and versatile tool for generating geometries with controlled complexity and investigating structure-property relationships across multidisciplinary fields.
|
|
61
|
+
|
|
62
|
+
Doğada ve mühendislik uygulamalarında karşılaşılan birçok sistem, karmaşık ve hiyerarşik geometrik yapılar sergiler. Bu yapıları anlamak ve modellemek için fraktal geometri güçlü bir araç sunar. Ancak, Apollon contası gibi mevcut deterministik dairesel paketleme fraktalları genellikle sabit geometrik kurallara bağlıdır ve gözlemlenen yapıların çeşitliliğini tam olarak yansıtmakta yetersiz kalabilir. Bu çalışmada, fiziksel ve matematiksel sistemlerin modellenmesinde daha fazla esneklik sağlama ihtiyacından doğan yeni bir deterministik fraktal olan Keçeci Dairesel Fraktalı (KDF) tanıtılmaktadır. KDF, özyinelemeli bir algoritma ile üretilir; burada bir ana daire, belirli bir ölçek faktörü (`scale_factor`) ile küçültülmüş ve sayısı (`initial_children`, `recursive_children`) kontrol edilebilen çocuk daireleri içerir. Bu parametreler, fraktalın morfolojik özelliklerinin (yoğunluk, boşluk dağılımı, sınır karmaşıklığı vb.) geniş bir aralıkta ayarlanmasına olanak tanır. KDF'nin temel avantajı, bu ayarlanabilir geometrisi sayesinde, gözenekli ortamlar (akışkan simülasyonları için), granüler malzeme paketlemeleri, köpük yapıları veya potansiyel olarak biyolojik kümeleşmeler gibi yapısal parametreleri farklılık gösteren çeşitli sistemleri daha gerçekçi bir şekilde modelleyebilmesidir. Ayrıca, KDF'nin kontrol edilebilir yapısı, dalga saçılması, ısı transferi veya elektriksel iletkenlik gibi yapıya bağlı fiziksel olayların incelenmesi için ideal bir test ortamı sunar. Matematiksel olarak, farklı parametre değerleri için fraktal boyut değişimlerini ve paketleme verimliliğini inceleme imkanı sunar. Sonuç olarak, Keçeci Dairesel Fraktalı, kontrollü karmaşıklığa sahip geometriler üretmek ve çok disiplinli alanlarda yapı-özellik ilişkilerini araştırmak için değerli ve çok yönlü bir araç olarak öne çıkmaktadır.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Installation / Kurulum
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
conda install bilgi::kececifractals -y
|
|
70
|
+
|
|
71
|
+
pip install kececifractals
|
|
72
|
+
```
|
|
73
|
+
https://anaconda.org/bilgi/kececifractals
|
|
74
|
+
|
|
75
|
+
https://pypi.org/project/kececifractals/
|
|
76
|
+
|
|
77
|
+
https://github.com/WhiteSymmetry/kececifractals
|
|
78
|
+
|
|
79
|
+
https://zenodo.org/records/
|
|
80
|
+
|
|
81
|
+
https://zenodo.org/records/
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Usage / Kullanım
|
|
86
|
+
|
|
87
|
+
### Example
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
import kececifractals as kf
|
|
91
|
+
import importlib # Useful if you modify the .py file and want to reload it
|
|
92
|
+
|
|
93
|
+
# --- Example 1: Show the fractal inline ---
|
|
94
|
+
print("Generating fractal to show inline...")
|
|
95
|
+
kf.kececifractals_circle(
|
|
96
|
+
initial_children=5,
|
|
97
|
+
recursive_children=5,
|
|
98
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
99
|
+
max_level=4,
|
|
100
|
+
scale_factor=0.5,
|
|
101
|
+
min_size_factor=0.001,
|
|
102
|
+
output_mode='show' # This will display the plot below the cell
|
|
103
|
+
)
|
|
104
|
+
print("Inline display finished.")
|
|
105
|
+
|
|
106
|
+
# --- Example 2: Save the fractal as an SVG file ---
|
|
107
|
+
print("\nGenerating fractal to save as SVG...")
|
|
108
|
+
kf.kececifractals_circle(
|
|
109
|
+
initial_children=7,
|
|
110
|
+
recursive_children=3,
|
|
111
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
112
|
+
max_level=5,
|
|
113
|
+
scale_factor=0.5,
|
|
114
|
+
min_size_factor=0.001,
|
|
115
|
+
base_radius=4.5,
|
|
116
|
+
background_color=(0.95, 0.9, 0.85), # Light beige
|
|
117
|
+
initial_circle_color=(0.3, 0.1, 0.1), # Dark brown
|
|
118
|
+
output_mode='svg',
|
|
119
|
+
filename="kececi_fractal_svg-1" # Will be saved in the notebook's directory
|
|
120
|
+
)
|
|
121
|
+
print("SVG saving finished.")
|
|
122
|
+
|
|
123
|
+
# --- Example 3: Save as PNG with high DPI ---
|
|
124
|
+
print("\nGenerating fractal to save as PNG...")
|
|
125
|
+
kf.kececifractals_circle(
|
|
126
|
+
initial_children=4,
|
|
127
|
+
recursive_children=6,
|
|
128
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
129
|
+
max_level=6, # Deeper recursion
|
|
130
|
+
scale_factor=0.5,
|
|
131
|
+
min_size_factor=0.001, # Smaller details
|
|
132
|
+
output_mode='png',
|
|
133
|
+
filename="kececi_fractal_png-1",
|
|
134
|
+
dpi=400 # High resolution
|
|
135
|
+
)
|
|
136
|
+
print("PNG saving finished.")
|
|
137
|
+
|
|
138
|
+
print("\nGenerating fractal and saving as JPG...")
|
|
139
|
+
kf.kececifractals_circle(
|
|
140
|
+
initial_children=5,
|
|
141
|
+
recursive_children=7,
|
|
142
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
143
|
+
max_level=5,
|
|
144
|
+
scale_factor=0.5,
|
|
145
|
+
min_size_factor=0.001,
|
|
146
|
+
output_mode='jpg', # Save as JPG
|
|
147
|
+
filename="kececifractal_jpg-1",
|
|
148
|
+
dpi=300 # Medium resolution JPG
|
|
149
|
+
)
|
|
150
|
+
print("JPG saving finished.")
|
|
151
|
+
|
|
152
|
+
# --- If you modify kececifractals.py and want to reload it ---
|
|
153
|
+
# Without restarting the Jupyter kernel:
|
|
154
|
+
print("\nReloading the module...")
|
|
155
|
+
importlib.reload(kf)
|
|
156
|
+
print("Module reloaded. Now you can run the commands again with the updated code.")
|
|
157
|
+
kf.kececifractals_circle(output_mode='show', text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı")
|
|
158
|
+
```
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
|
|
167
|
+

|
|
168
|
+
|
|
169
|
+

|
|
170
|
+
|
|
171
|
+

|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## License / Lisans
|
|
179
|
+
|
|
180
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
181
|
+
|
|
182
|
+
## Citation
|
|
183
|
+
|
|
184
|
+
If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.
|
|
185
|
+
|
|
186
|
+
### BibTeX
|
|
187
|
+
|
|
188
|
+
```bibtex
|
|
189
|
+
@misc{kececi_2025_,
|
|
190
|
+
author = {Keçeci, Mehmet},
|
|
191
|
+
title = {kececifractals},
|
|
192
|
+
month = may,
|
|
193
|
+
year = 2025,
|
|
194
|
+
publisher = {PyPI, Anaconda, Github, Zenodo},
|
|
195
|
+
version = {0.1.0},
|
|
196
|
+
doi = {10.5281/zenodo.},
|
|
197
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@misc{kececi_2025_,
|
|
201
|
+
author = {Keçeci, Mehmet},
|
|
202
|
+
title = {Keçeci Fractals},
|
|
203
|
+
month = may,
|
|
204
|
+
year = 2025,
|
|
205
|
+
publisher = {Zenodo},
|
|
206
|
+
version = {0.1.0},
|
|
207
|
+
doi = {10.5281/zenodo.},
|
|
208
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### APA
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
Keçeci, M. (2025). kececifractals (0.1.0). PyPI, Anaconda, GitHub, Zenodo. https://doi.org/10.5281/zenodo.
|
|
216
|
+
|
|
217
|
+
Keçeci, M. (2025). kececifractals (0.1.0). GitHub, PyPI, Anaconda, Zenodo. https://doi.org/10.5281/zenodo.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Chicago
|
|
223
|
+
```
|
|
224
|
+
Keçeci, Mehmet. "kececifractals". PyPI, Anaconda, GitHub, Zenodo, 01 May 2025. https://doi.org/10.5281/zenodo.
|
|
225
|
+
|
|
226
|
+
Keçeci, Mehmet. "kececifractals". GitHub, PyPI, Anaconda, Zenodo, 11 May 2025. https://doi.org/10.5281/zenodo.
|
|
227
|
+
|
|
228
|
+
```
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Keçeci Fractals: Keçeci Fraktals
|
|
2
|
+
|
|
3
|
+
Keçeci Circle Fractal: Keçeci-style circle fractal.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/kececifractals)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
9
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
10
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
11
|
+
|
|
12
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
13
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
14
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
15
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
16
|
+
|
|
17
|
+
[](https://opensource.org/)
|
|
18
|
+
[](https://kececifractals.readthedocs.io/en/latest)
|
|
19
|
+
|
|
20
|
+
[](https://www.bestpractices.dev/projects/)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Description / Açıklama
|
|
25
|
+
|
|
26
|
+
**Keçeci Circle Fractal: Keçeci-style circle fractal.**:
|
|
27
|
+
|
|
28
|
+
Many systems encountered in nature and engineering exhibit complex and hierarchical geometric structures. Fractal geometry provides a powerful tool for understanding and modeling these structures. However, existing deterministic circle packing fractals, such as the Apollonian gasket, often adhere to fixed geometric rules and may fall short in accurately reflecting the diversity of observed structures. Addressing the need for greater flexibility in modeling physical and mathematical systems, this paper introduces the Keçeci Circle Fractal (KCF), a novel deterministic fractal. The KCF is generated through a recursive algorithm where a parent circle contains child circles scaled down by a specific `scale_factor` and whose number (`initial_children`, `recursive_children`) is controllable. These parameters allow for the tuning of the fractal's morphological characteristics (e.g., density, void distribution, boundary complexity) over a wide range. The primary advantage of the KCF lies in its tunable geometry, enabling more realistic modeling of diverse systems with varying structural parameters, such as porous media (for fluid flow simulations), granular material packings, foam structures, or potentially biological aggregations. Furthermore, the controllable structure of the KCF provides an ideal testbed for investigating structure-dependent physical phenomena like wave scattering, heat transfer, or electrical conductivity. Mathematically, it offers opportunities to study variations in fractal dimension and packing efficiency for different parameter values. In conclusion, the Keçeci Circle Fractal emerges as a valuable and versatile tool for generating geometries with controlled complexity and investigating structure-property relationships across multidisciplinary fields.
|
|
29
|
+
|
|
30
|
+
Doğada ve mühendislik uygulamalarında karşılaşılan birçok sistem, karmaşık ve hiyerarşik geometrik yapılar sergiler. Bu yapıları anlamak ve modellemek için fraktal geometri güçlü bir araç sunar. Ancak, Apollon contası gibi mevcut deterministik dairesel paketleme fraktalları genellikle sabit geometrik kurallara bağlıdır ve gözlemlenen yapıların çeşitliliğini tam olarak yansıtmakta yetersiz kalabilir. Bu çalışmada, fiziksel ve matematiksel sistemlerin modellenmesinde daha fazla esneklik sağlama ihtiyacından doğan yeni bir deterministik fraktal olan Keçeci Dairesel Fraktalı (KDF) tanıtılmaktadır. KDF, özyinelemeli bir algoritma ile üretilir; burada bir ana daire, belirli bir ölçek faktörü (`scale_factor`) ile küçültülmüş ve sayısı (`initial_children`, `recursive_children`) kontrol edilebilen çocuk daireleri içerir. Bu parametreler, fraktalın morfolojik özelliklerinin (yoğunluk, boşluk dağılımı, sınır karmaşıklığı vb.) geniş bir aralıkta ayarlanmasına olanak tanır. KDF'nin temel avantajı, bu ayarlanabilir geometrisi sayesinde, gözenekli ortamlar (akışkan simülasyonları için), granüler malzeme paketlemeleri, köpük yapıları veya potansiyel olarak biyolojik kümeleşmeler gibi yapısal parametreleri farklılık gösteren çeşitli sistemleri daha gerçekçi bir şekilde modelleyebilmesidir. Ayrıca, KDF'nin kontrol edilebilir yapısı, dalga saçılması, ısı transferi veya elektriksel iletkenlik gibi yapıya bağlı fiziksel olayların incelenmesi için ideal bir test ortamı sunar. Matematiksel olarak, farklı parametre değerleri için fraktal boyut değişimlerini ve paketleme verimliliğini inceleme imkanı sunar. Sonuç olarak, Keçeci Dairesel Fraktalı, kontrollü karmaşıklığa sahip geometriler üretmek ve çok disiplinli alanlarda yapı-özellik ilişkilerini araştırmak için değerli ve çok yönlü bir araç olarak öne çıkmaktadır.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation / Kurulum
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
conda install bilgi::kececifractals -y
|
|
38
|
+
|
|
39
|
+
pip install kececifractals
|
|
40
|
+
```
|
|
41
|
+
https://anaconda.org/bilgi/kececifractals
|
|
42
|
+
|
|
43
|
+
https://pypi.org/project/kececifractals/
|
|
44
|
+
|
|
45
|
+
https://github.com/WhiteSymmetry/kececifractals
|
|
46
|
+
|
|
47
|
+
https://zenodo.org/records/
|
|
48
|
+
|
|
49
|
+
https://zenodo.org/records/
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Usage / Kullanım
|
|
54
|
+
|
|
55
|
+
### Example
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import kececifractals as kf
|
|
59
|
+
import importlib # Useful if you modify the .py file and want to reload it
|
|
60
|
+
|
|
61
|
+
# --- Example 1: Show the fractal inline ---
|
|
62
|
+
print("Generating fractal to show inline...")
|
|
63
|
+
kf.kececifractals_circle(
|
|
64
|
+
initial_children=5,
|
|
65
|
+
recursive_children=5,
|
|
66
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
67
|
+
max_level=4,
|
|
68
|
+
scale_factor=0.5,
|
|
69
|
+
min_size_factor=0.001,
|
|
70
|
+
output_mode='show' # This will display the plot below the cell
|
|
71
|
+
)
|
|
72
|
+
print("Inline display finished.")
|
|
73
|
+
|
|
74
|
+
# --- Example 2: Save the fractal as an SVG file ---
|
|
75
|
+
print("\nGenerating fractal to save as SVG...")
|
|
76
|
+
kf.kececifractals_circle(
|
|
77
|
+
initial_children=7,
|
|
78
|
+
recursive_children=3,
|
|
79
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
80
|
+
max_level=5,
|
|
81
|
+
scale_factor=0.5,
|
|
82
|
+
min_size_factor=0.001,
|
|
83
|
+
base_radius=4.5,
|
|
84
|
+
background_color=(0.95, 0.9, 0.85), # Light beige
|
|
85
|
+
initial_circle_color=(0.3, 0.1, 0.1), # Dark brown
|
|
86
|
+
output_mode='svg',
|
|
87
|
+
filename="kececi_fractal_svg-1" # Will be saved in the notebook's directory
|
|
88
|
+
)
|
|
89
|
+
print("SVG saving finished.")
|
|
90
|
+
|
|
91
|
+
# --- Example 3: Save as PNG with high DPI ---
|
|
92
|
+
print("\nGenerating fractal to save as PNG...")
|
|
93
|
+
kf.kececifractals_circle(
|
|
94
|
+
initial_children=4,
|
|
95
|
+
recursive_children=6,
|
|
96
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
97
|
+
max_level=6, # Deeper recursion
|
|
98
|
+
scale_factor=0.5,
|
|
99
|
+
min_size_factor=0.001, # Smaller details
|
|
100
|
+
output_mode='png',
|
|
101
|
+
filename="kececi_fractal_png-1",
|
|
102
|
+
dpi=400 # High resolution
|
|
103
|
+
)
|
|
104
|
+
print("PNG saving finished.")
|
|
105
|
+
|
|
106
|
+
print("\nGenerating fractal and saving as JPG...")
|
|
107
|
+
kf.kececifractals_circle(
|
|
108
|
+
initial_children=5,
|
|
109
|
+
recursive_children=7,
|
|
110
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
111
|
+
max_level=5,
|
|
112
|
+
scale_factor=0.5,
|
|
113
|
+
min_size_factor=0.001,
|
|
114
|
+
output_mode='jpg', # Save as JPG
|
|
115
|
+
filename="kececifractal_jpg-1",
|
|
116
|
+
dpi=300 # Medium resolution JPG
|
|
117
|
+
)
|
|
118
|
+
print("JPG saving finished.")
|
|
119
|
+
|
|
120
|
+
# --- If you modify kececifractals.py and want to reload it ---
|
|
121
|
+
# Without restarting the Jupyter kernel:
|
|
122
|
+
print("\nReloading the module...")
|
|
123
|
+
importlib.reload(kf)
|
|
124
|
+
print("Module reloaded. Now you can run the commands again with the updated code.")
|
|
125
|
+
kf.kececifractals_circle(output_mode='show', text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı")
|
|
126
|
+
```
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+

|
|
132
|
+
|
|
133
|
+

|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+

|
|
138
|
+
|
|
139
|
+

|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## License / Lisans
|
|
147
|
+
|
|
148
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
149
|
+
|
|
150
|
+
## Citation
|
|
151
|
+
|
|
152
|
+
If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.
|
|
153
|
+
|
|
154
|
+
### BibTeX
|
|
155
|
+
|
|
156
|
+
```bibtex
|
|
157
|
+
@misc{kececi_2025_,
|
|
158
|
+
author = {Keçeci, Mehmet},
|
|
159
|
+
title = {kececifractals},
|
|
160
|
+
month = may,
|
|
161
|
+
year = 2025,
|
|
162
|
+
publisher = {PyPI, Anaconda, Github, Zenodo},
|
|
163
|
+
version = {0.1.0},
|
|
164
|
+
doi = {10.5281/zenodo.},
|
|
165
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@misc{kececi_2025_,
|
|
169
|
+
author = {Keçeci, Mehmet},
|
|
170
|
+
title = {Keçeci Fractals},
|
|
171
|
+
month = may,
|
|
172
|
+
year = 2025,
|
|
173
|
+
publisher = {Zenodo},
|
|
174
|
+
version = {0.1.0},
|
|
175
|
+
doi = {10.5281/zenodo.},
|
|
176
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### APA
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Keçeci, M. (2025). kececifractals (0.1.0). PyPI, Anaconda, GitHub, Zenodo. https://doi.org/10.5281/zenodo.
|
|
184
|
+
|
|
185
|
+
Keçeci, M. (2025). kececifractals (0.1.0). GitHub, PyPI, Anaconda, Zenodo. https://doi.org/10.5281/zenodo.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Chicago
|
|
191
|
+
```
|
|
192
|
+
Keçeci, Mehmet. "kececifractals". PyPI, Anaconda, GitHub, Zenodo, 01 May 2025. https://doi.org/10.5281/zenodo.
|
|
193
|
+
|
|
194
|
+
Keçeci, Mehmet. "kececifractals". GitHub, PyPI, Anaconda, Zenodo, 11 May 2025. https://doi.org/10.5281/zenodo.
|
|
195
|
+
|
|
196
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# __init__.py
|
|
2
|
+
# Bu dosya paketin başlangıç noktası olarak çalışır.
|
|
3
|
+
# Alt modülleri yükler, sürüm bilgileri tanımlar ve geriye dönük uyumluluk için uyarılar sağlar.
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
import importlib
|
|
7
|
+
import warnings
|
|
8
|
+
import os
|
|
9
|
+
# if os.getenv("DEVELOPMENT") == "true":
|
|
10
|
+
# importlib.reload(kececifractals) # F821 undefined name 'kececifractals'
|
|
11
|
+
|
|
12
|
+
# Göreli modül içe aktarmaları
|
|
13
|
+
# F401 hatasını önlemek için sadece kullanacağınız şeyleri dışa aktarın
|
|
14
|
+
# Aksi halde linter'lar "imported but unused" uyarısı verir
|
|
15
|
+
try:
|
|
16
|
+
from .kececifractals import * # gerekirse burada belirli fonksiyonları seçmeli yapmak daha güvenlidir
|
|
17
|
+
from . import kececifractals # Modülün kendisine doğrudan erişim isteniyorsa
|
|
18
|
+
except ImportError as e:
|
|
19
|
+
warnings.warn(f"Gerekli modül yüklenemedi: {e}", ImportWarning)
|
|
20
|
+
|
|
21
|
+
# Eski bir fonksiyonun yer tutucusu - gelecekte kaldırılacak
|
|
22
|
+
def eski_fonksiyon():
|
|
23
|
+
"""
|
|
24
|
+
Kaldırılması planlanan eski bir fonksiyondur.
|
|
25
|
+
Lütfen alternatif fonksiyonları kullanın.
|
|
26
|
+
"""
|
|
27
|
+
warnings.warn(
|
|
28
|
+
"eski_fonksiyon() artık kullanılmamaktadır ve gelecekte kaldırılacaktır. "
|
|
29
|
+
"Lütfen yeni alternatif fonksiyonları kullanın. "
|
|
30
|
+
"Keçeci Fractals; Python 3.9-3.14 sürümlerinde sorunsuz çalışmalıdır.",
|
|
31
|
+
category=DeprecationWarning,
|
|
32
|
+
stacklevel=2
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Paket sürüm numarası
|
|
37
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# _version.py
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
__license__ = "MIT"
|
|
5
|
+
__description__ = "Keçeci Fractals: Keçeci-style circle fractal."
|
|
6
|
+
__author__ = "Mehmet Keçeci"
|
|
7
|
+
__url__ = "https://github.com/WhiteSymmetry/kececifractals"
|
|
8
|
+
__docs__ = "https://github.com/WhiteSymmetry/kececifractals" # Opsiyonel: Dokümantasyon linki
|
|
9
|
+
__dependencies__ = ["python>=3.9"] # Diğer bağımlılıkları da ekleyebilirsiniz
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# kececifractals.py
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import matplotlib.pyplot as plt
|
|
5
|
+
from matplotlib.patches import Circle
|
|
6
|
+
import random
|
|
7
|
+
import math
|
|
8
|
+
import sys
|
|
9
|
+
import os # Import os to potentially handle file paths
|
|
10
|
+
|
|
11
|
+
# --- Helper Functions ---
|
|
12
|
+
|
|
13
|
+
def random_soft_color():
|
|
14
|
+
"""Generates a random soft RGB color tuple."""
|
|
15
|
+
return tuple(random.uniform(0.4, 0.95) for _ in range(3))
|
|
16
|
+
|
|
17
|
+
def draw_circle(ax, center, radius, color):
|
|
18
|
+
"""Adds a circle patch to the Matplotlib axes."""
|
|
19
|
+
# Using fill=True and linewidth=0 is efficient for solid circles
|
|
20
|
+
ax.add_patch(Circle(center, radius, color=color, fill=True, linewidth=0))
|
|
21
|
+
|
|
22
|
+
# --- Recursive Fractal Drawing (Internal Helper) ---
|
|
23
|
+
|
|
24
|
+
def _draw_recursive_circles(ax, x, y, radius, level, max_level, num_children, min_radius, scale_factor):
|
|
25
|
+
"""
|
|
26
|
+
Internal helper recursive function to draw child circles. Not intended for direct use.
|
|
27
|
+
"""
|
|
28
|
+
# Base Case: Stop recursion if max level is reached
|
|
29
|
+
if level > max_level:
|
|
30
|
+
return
|
|
31
|
+
|
|
32
|
+
child_radius = radius * scale_factor
|
|
33
|
+
|
|
34
|
+
# Optimization: Stop if child circles will be too small
|
|
35
|
+
if child_radius < min_radius:
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
# Calculate the distance from the parent center to the child centers
|
|
39
|
+
distance_from_parent_center = radius - child_radius
|
|
40
|
+
|
|
41
|
+
# --- Place and Draw Child Circles ---
|
|
42
|
+
for i in range(num_children):
|
|
43
|
+
# Calculate the angle for this child
|
|
44
|
+
angle_rad = np.deg2rad(360 / num_children * i)
|
|
45
|
+
|
|
46
|
+
# Calculate the center of the child circle
|
|
47
|
+
child_x = x + distance_from_parent_center * np.cos(angle_rad)
|
|
48
|
+
child_y = y + distance_from_parent_center * np.sin(angle_rad)
|
|
49
|
+
|
|
50
|
+
# Draw the child circle
|
|
51
|
+
child_color = random_soft_color()
|
|
52
|
+
draw_circle(ax, (child_x, child_y), child_radius, child_color)
|
|
53
|
+
|
|
54
|
+
# Recursive Call for the next level
|
|
55
|
+
try:
|
|
56
|
+
_draw_recursive_circles(ax, child_x, child_y, child_radius, level + 1,
|
|
57
|
+
max_level, num_children, min_radius, scale_factor)
|
|
58
|
+
except RecursionError:
|
|
59
|
+
# Print a warning if recursion depth is exceeded, but continue if possible
|
|
60
|
+
print(f"Warning: Maximum recursion depth likely reached near level {level+1}. "
|
|
61
|
+
f"Fractal generation may be incomplete. "
|
|
62
|
+
f"Consider reducing max_level or increasing min_size_factor.", file=sys.stderr)
|
|
63
|
+
# Stop this branch of recursion if depth limit is hit
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
# --- Main Public Function ---
|
|
67
|
+
|
|
68
|
+
def kececifractals_circle(
|
|
69
|
+
initial_children=6,
|
|
70
|
+
recursive_children=6,
|
|
71
|
+
text="Keçeci Fractals",
|
|
72
|
+
font_size=14,
|
|
73
|
+
font_color='black',
|
|
74
|
+
font_style='bold',
|
|
75
|
+
font_family='Arial',
|
|
76
|
+
max_level=4,
|
|
77
|
+
min_size_factor=0.001, # Practical minimum > 0, e.g., 0.001 or lower
|
|
78
|
+
scale_factor=0.5, # Adjusted default for potentially better visual separation
|
|
79
|
+
base_radius=4.0,
|
|
80
|
+
background_color=None,
|
|
81
|
+
initial_circle_color=None,
|
|
82
|
+
output_mode='show', # 'show', 'png', 'svg', 'jpg'
|
|
83
|
+
filename="kececi_fractal_circle-1", # Base filename for saving
|
|
84
|
+
dpi=300 # Resolution for raster formats (png, jpg)
|
|
85
|
+
):
|
|
86
|
+
"""
|
|
87
|
+
Generates and displays or saves a Keçeci-style circle fractal.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
initial_children (int): Number of circles in the first level.
|
|
91
|
+
recursive_children (int): Number of children per circle in recursion.
|
|
92
|
+
text (str): Text to display circularly around the fractal. Empty string for no text.
|
|
93
|
+
font_size (int): Font size for the text.
|
|
94
|
+
font_color (str): Color of the text (matplotlib color format).
|
|
95
|
+
font_style (str): Font style for the text ('normal', 'bold', etc.).
|
|
96
|
+
font_family (str): Font family for the text.
|
|
97
|
+
max_level (int): Maximum recursion depth. Level 0 is the main circle.
|
|
98
|
+
min_size_factor (float): Stop recursion if radius < base_radius * min_size_factor.
|
|
99
|
+
Must be > 0. Practical limit depends on visual needs/resources.
|
|
100
|
+
scale_factor (float): Ratio of child radius to parent radius (0 < scale_factor < 1).
|
|
101
|
+
base_radius (float): Radius of the initial, largest circle.
|
|
102
|
+
background_color (tuple|str|None): Background color. Uses random_soft_color() if None.
|
|
103
|
+
initial_circle_color (tuple|str|None): Color of the main circle. Uses random_soft_color() if None.
|
|
104
|
+
output_mode (str): 'show' to display inline (Jupyter) or in a window,
|
|
105
|
+
'png', 'svg', 'jpg' to save in that format.
|
|
106
|
+
filename (str): Base filename for saving (extension is added automatically).
|
|
107
|
+
The file is saved in the current working directory.
|
|
108
|
+
dpi (int): Dots Per Inch resolution for saving PNG and JPG files.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
None: Displays the plot or saves it to a file.
|
|
112
|
+
"""
|
|
113
|
+
# Input validation
|
|
114
|
+
if not isinstance(max_level, int) or max_level < 0:
|
|
115
|
+
print("Error: max_level must be a non-negative integer.", file=sys.stderr)
|
|
116
|
+
return
|
|
117
|
+
if not isinstance(min_size_factor, (int, float)) or min_size_factor <= 0:
|
|
118
|
+
print("Error: min_size_factor must be a positive number.", file=sys.stderr)
|
|
119
|
+
return
|
|
120
|
+
if not isinstance(scale_factor, (int, float)) or not (0 < scale_factor < 1):
|
|
121
|
+
print("Error: scale_factor must be a number between 0 and 1 (exclusive).", file=sys.stderr)
|
|
122
|
+
return
|
|
123
|
+
|
|
124
|
+
# Setup plot
|
|
125
|
+
fig_size = 10 # Maintain a consistent figure size
|
|
126
|
+
fig, ax = plt.subplots(figsize=(fig_size, fig_size))
|
|
127
|
+
|
|
128
|
+
# Colors
|
|
129
|
+
bg_color = background_color if background_color else random_soft_color()
|
|
130
|
+
fig.patch.set_facecolor(bg_color)
|
|
131
|
+
main_color = initial_circle_color if initial_circle_color else random_soft_color()
|
|
132
|
+
|
|
133
|
+
# Draw main circle (Level 0)
|
|
134
|
+
draw_circle(ax, (0, 0), base_radius, main_color)
|
|
135
|
+
|
|
136
|
+
# Calculate minimum absolute size
|
|
137
|
+
min_absolute_radius = base_radius * min_size_factor
|
|
138
|
+
|
|
139
|
+
# --- Text Placement ---
|
|
140
|
+
limit = base_radius + 1.0 # Default plot limit
|
|
141
|
+
if text and isinstance(text, str) and len(text) > 0:
|
|
142
|
+
outer_bound_radius = base_radius
|
|
143
|
+
text_radius = outer_bound_radius + 0.8 # Place text slightly outside
|
|
144
|
+
for i, char in enumerate(text):
|
|
145
|
+
angle_deg = (360 / len(text) * i) - 90 # Start from top
|
|
146
|
+
angle_rad = np.deg2rad(angle_deg)
|
|
147
|
+
x_text = text_radius * np.cos(angle_rad)
|
|
148
|
+
y_text = text_radius * np.sin(angle_rad)
|
|
149
|
+
rotation = angle_deg + 90 # Rotate character appropriately
|
|
150
|
+
ax.text(x_text, y_text, char, fontsize=font_size, ha='center', va='center',
|
|
151
|
+
color=font_color, fontweight=font_style, fontname=font_family, rotation=rotation)
|
|
152
|
+
# Adjust plot limits to ensure text is visible
|
|
153
|
+
limit = max(limit, text_radius + font_size * 0.1) # Add buffer based on font size
|
|
154
|
+
|
|
155
|
+
# --- Draw First Level (Level 1) Children and Start Recursion ---
|
|
156
|
+
if max_level >= 1:
|
|
157
|
+
initial_radius = base_radius * scale_factor
|
|
158
|
+
# Check if the *first* level children are large enough
|
|
159
|
+
if initial_radius >= min_absolute_radius:
|
|
160
|
+
# Distance from the center of the main circle to the centers of the first-level children
|
|
161
|
+
dist_initial = base_radius - initial_radius # = base_radius * (1 - scale_factor)
|
|
162
|
+
|
|
163
|
+
for i in range(initial_children):
|
|
164
|
+
angle_rad = np.deg2rad(360 / initial_children * i)
|
|
165
|
+
# Calculate center of this initial child
|
|
166
|
+
ix = 0 + dist_initial * np.cos(angle_rad)
|
|
167
|
+
iy = 0 + dist_initial * np.sin(angle_rad)
|
|
168
|
+
i_color = random_soft_color()
|
|
169
|
+
|
|
170
|
+
# Draw the initial child (Level 1)
|
|
171
|
+
draw_circle(ax, (ix, iy), initial_radius, i_color)
|
|
172
|
+
|
|
173
|
+
# Start recursion for this child, beginning at Level 2
|
|
174
|
+
_draw_recursive_circles(ax, ix, iy, initial_radius, level=2,
|
|
175
|
+
max_level=max_level,
|
|
176
|
+
num_children=recursive_children,
|
|
177
|
+
min_radius=min_absolute_radius,
|
|
178
|
+
scale_factor=scale_factor)
|
|
179
|
+
|
|
180
|
+
# --- Final Plot Adjustments ---
|
|
181
|
+
ax.set_xlim(-limit, limit)
|
|
182
|
+
ax.set_ylim(-limit, limit)
|
|
183
|
+
ax.set_aspect('equal', adjustable='box') # Ensure circles look like circles
|
|
184
|
+
ax.axis('off') # Hide the axes
|
|
185
|
+
# Set title only if text is not empty, otherwise use a generic title
|
|
186
|
+
plot_title = f"Keçeci Fractals ({text})" if text else "Keçeci Circle Fractal"
|
|
187
|
+
plt.title(plot_title, fontsize=16)
|
|
188
|
+
|
|
189
|
+
# --- Output Handling ---
|
|
190
|
+
output_mode = output_mode.lower().strip() # Normalize output mode string
|
|
191
|
+
|
|
192
|
+
if output_mode == 'show':
|
|
193
|
+
plt.show() # Displays the plot (inline in Jupyter, or new window)
|
|
194
|
+
# NOTE: No plt.close() here, as show() handles the figure lifecycle.
|
|
195
|
+
elif output_mode in ['png', 'jpg', 'svg']:
|
|
196
|
+
# Construct full filename in the current working directory
|
|
197
|
+
output_filename = f"{filename}.{output_mode}"
|
|
198
|
+
try:
|
|
199
|
+
save_kwargs = {
|
|
200
|
+
'bbox_inches': 'tight', # Crop whitespace
|
|
201
|
+
'pad_inches': 0.1, # Small padding
|
|
202
|
+
'facecolor': fig.get_facecolor() # Ensure background color is saved
|
|
203
|
+
}
|
|
204
|
+
if output_mode in ['png', 'jpg']:
|
|
205
|
+
save_kwargs['dpi'] = dpi # Set resolution for raster images
|
|
206
|
+
|
|
207
|
+
plt.savefig(output_filename, format=output_mode, **save_kwargs)
|
|
208
|
+
print(f"Fractal successfully saved as '{os.path.abspath(output_filename)}'") # Show full path
|
|
209
|
+
except Exception as e:
|
|
210
|
+
print(f"Error saving {output_mode.upper()} file '{output_filename}': {e}", file=sys.stderr)
|
|
211
|
+
finally:
|
|
212
|
+
# IMPORTANT: Close the figure *after* saving or error to free memory
|
|
213
|
+
plt.close(fig)
|
|
214
|
+
else:
|
|
215
|
+
print(f"Error: Invalid output_mode '{output_mode}'. Choose 'show', 'png', 'jpg', or 'svg'.", file=sys.stderr)
|
|
216
|
+
# Close the figure if the mode was invalid and plotting happened
|
|
217
|
+
plt.close(fig)
|
|
218
|
+
|
|
219
|
+
# --- Optional: Code to run only when the script is executed directly ---
|
|
220
|
+
# This block is useful for testing the module from the command line
|
|
221
|
+
# It will NOT run when the module is imported
|
|
222
|
+
if __name__ == "__main__":
|
|
223
|
+
print(f"--- Running Test Cases for {os.path.basename(__file__)} ---")
|
|
224
|
+
|
|
225
|
+
print("\n[Test 1: Displaying fractal inline/window (output_mode='show')]")
|
|
226
|
+
kececifractals_circle(
|
|
227
|
+
initial_children=5,
|
|
228
|
+
recursive_children=4,
|
|
229
|
+
text="Test Show",
|
|
230
|
+
max_level=3,
|
|
231
|
+
scale_factor=0.5,
|
|
232
|
+
min_size_factor=0.001,
|
|
233
|
+
output_mode='show'
|
|
234
|
+
)
|
|
235
|
+
print("--- Test 1 Complete ---")
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
print("\n[Test 2: Saving fractal as PNG]")
|
|
239
|
+
kececifractals_circle(
|
|
240
|
+
initial_children=7,
|
|
241
|
+
recursive_children=3,
|
|
242
|
+
text="Test PNG",
|
|
243
|
+
max_level=4,
|
|
244
|
+
scale_factor=0.5,
|
|
245
|
+
min_size_factor=0.001,
|
|
246
|
+
base_radius=5,
|
|
247
|
+
background_color='#101030', # Dark blue hex
|
|
248
|
+
initial_circle_color='yellow',
|
|
249
|
+
output_mode='png',
|
|
250
|
+
filename="test_fractal_output_png-1",
|
|
251
|
+
dpi=150 # Lower DPI for quick test save
|
|
252
|
+
)
|
|
253
|
+
print("--- Test 2 Complete ---")
|
|
254
|
+
|
|
255
|
+
print("\n[Test 3: Saving fractal as SVG]")
|
|
256
|
+
kececifractals_circle(
|
|
257
|
+
initial_children=6,
|
|
258
|
+
recursive_children=5,
|
|
259
|
+
text="Test SVG",
|
|
260
|
+
max_level=2, # Shallow level for quick test
|
|
261
|
+
scale_factor=0.5,
|
|
262
|
+
min_size_factor=0.001,
|
|
263
|
+
output_mode='svg',
|
|
264
|
+
filename="test_fractal_output_svg-1"
|
|
265
|
+
)
|
|
266
|
+
print("--- Test 3 Complete ---")
|
|
267
|
+
|
|
268
|
+
print("\n[Test 4: Invalid Mode]")
|
|
269
|
+
kececifractals_circle(output_mode='gif') # Intentionally invalid
|
|
270
|
+
print("--- Test 4 Complete ---")
|
|
271
|
+
|
|
272
|
+
print("\n--- All Direct Execution Tests Finished ---")
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kececifractals
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: eçeci Fractals: Keçeci-style circle fractal.
|
|
5
|
+
Home-page: https://github.com/WhiteSymmetry/kececifractals
|
|
6
|
+
Author: Mehmet Keçeci
|
|
7
|
+
Author-email: bilginomi@yaani.com
|
|
8
|
+
Maintainer: Mehmet Keçeci
|
|
9
|
+
Maintainer-email: bilginomi@yaani.com
|
|
10
|
+
License: MIT
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: maintainer
|
|
28
|
+
Dynamic: maintainer-email
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# Keçeci Fractals: Keçeci Fraktals
|
|
34
|
+
|
|
35
|
+
Keçeci Circle Fractal: Keçeci-style circle fractal.
|
|
36
|
+
|
|
37
|
+
[](https://badge.fury.io/py/kececifractals)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
|
|
40
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
41
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
42
|
+
[](https://doi.org/10.5281/zenodo.)
|
|
43
|
+
|
|
44
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
45
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
46
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
47
|
+
[](https://anaconda.org/bilgi/kececifractals)
|
|
48
|
+
|
|
49
|
+
[](https://opensource.org/)
|
|
50
|
+
[](https://kececifractals.readthedocs.io/en/latest)
|
|
51
|
+
|
|
52
|
+
[](https://www.bestpractices.dev/projects/)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Description / Açıklama
|
|
57
|
+
|
|
58
|
+
**Keçeci Circle Fractal: Keçeci-style circle fractal.**:
|
|
59
|
+
|
|
60
|
+
Many systems encountered in nature and engineering exhibit complex and hierarchical geometric structures. Fractal geometry provides a powerful tool for understanding and modeling these structures. However, existing deterministic circle packing fractals, such as the Apollonian gasket, often adhere to fixed geometric rules and may fall short in accurately reflecting the diversity of observed structures. Addressing the need for greater flexibility in modeling physical and mathematical systems, this paper introduces the Keçeci Circle Fractal (KCF), a novel deterministic fractal. The KCF is generated through a recursive algorithm where a parent circle contains child circles scaled down by a specific `scale_factor` and whose number (`initial_children`, `recursive_children`) is controllable. These parameters allow for the tuning of the fractal's morphological characteristics (e.g., density, void distribution, boundary complexity) over a wide range. The primary advantage of the KCF lies in its tunable geometry, enabling more realistic modeling of diverse systems with varying structural parameters, such as porous media (for fluid flow simulations), granular material packings, foam structures, or potentially biological aggregations. Furthermore, the controllable structure of the KCF provides an ideal testbed for investigating structure-dependent physical phenomena like wave scattering, heat transfer, or electrical conductivity. Mathematically, it offers opportunities to study variations in fractal dimension and packing efficiency for different parameter values. In conclusion, the Keçeci Circle Fractal emerges as a valuable and versatile tool for generating geometries with controlled complexity and investigating structure-property relationships across multidisciplinary fields.
|
|
61
|
+
|
|
62
|
+
Doğada ve mühendislik uygulamalarında karşılaşılan birçok sistem, karmaşık ve hiyerarşik geometrik yapılar sergiler. Bu yapıları anlamak ve modellemek için fraktal geometri güçlü bir araç sunar. Ancak, Apollon contası gibi mevcut deterministik dairesel paketleme fraktalları genellikle sabit geometrik kurallara bağlıdır ve gözlemlenen yapıların çeşitliliğini tam olarak yansıtmakta yetersiz kalabilir. Bu çalışmada, fiziksel ve matematiksel sistemlerin modellenmesinde daha fazla esneklik sağlama ihtiyacından doğan yeni bir deterministik fraktal olan Keçeci Dairesel Fraktalı (KDF) tanıtılmaktadır. KDF, özyinelemeli bir algoritma ile üretilir; burada bir ana daire, belirli bir ölçek faktörü (`scale_factor`) ile küçültülmüş ve sayısı (`initial_children`, `recursive_children`) kontrol edilebilen çocuk daireleri içerir. Bu parametreler, fraktalın morfolojik özelliklerinin (yoğunluk, boşluk dağılımı, sınır karmaşıklığı vb.) geniş bir aralıkta ayarlanmasına olanak tanır. KDF'nin temel avantajı, bu ayarlanabilir geometrisi sayesinde, gözenekli ortamlar (akışkan simülasyonları için), granüler malzeme paketlemeleri, köpük yapıları veya potansiyel olarak biyolojik kümeleşmeler gibi yapısal parametreleri farklılık gösteren çeşitli sistemleri daha gerçekçi bir şekilde modelleyebilmesidir. Ayrıca, KDF'nin kontrol edilebilir yapısı, dalga saçılması, ısı transferi veya elektriksel iletkenlik gibi yapıya bağlı fiziksel olayların incelenmesi için ideal bir test ortamı sunar. Matematiksel olarak, farklı parametre değerleri için fraktal boyut değişimlerini ve paketleme verimliliğini inceleme imkanı sunar. Sonuç olarak, Keçeci Dairesel Fraktalı, kontrollü karmaşıklığa sahip geometriler üretmek ve çok disiplinli alanlarda yapı-özellik ilişkilerini araştırmak için değerli ve çok yönlü bir araç olarak öne çıkmaktadır.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Installation / Kurulum
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
conda install bilgi::kececifractals -y
|
|
70
|
+
|
|
71
|
+
pip install kececifractals
|
|
72
|
+
```
|
|
73
|
+
https://anaconda.org/bilgi/kececifractals
|
|
74
|
+
|
|
75
|
+
https://pypi.org/project/kececifractals/
|
|
76
|
+
|
|
77
|
+
https://github.com/WhiteSymmetry/kececifractals
|
|
78
|
+
|
|
79
|
+
https://zenodo.org/records/
|
|
80
|
+
|
|
81
|
+
https://zenodo.org/records/
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Usage / Kullanım
|
|
86
|
+
|
|
87
|
+
### Example
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
import kececifractals as kf
|
|
91
|
+
import importlib # Useful if you modify the .py file and want to reload it
|
|
92
|
+
|
|
93
|
+
# --- Example 1: Show the fractal inline ---
|
|
94
|
+
print("Generating fractal to show inline...")
|
|
95
|
+
kf.kececifractals_circle(
|
|
96
|
+
initial_children=5,
|
|
97
|
+
recursive_children=5,
|
|
98
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
99
|
+
max_level=4,
|
|
100
|
+
scale_factor=0.5,
|
|
101
|
+
min_size_factor=0.001,
|
|
102
|
+
output_mode='show' # This will display the plot below the cell
|
|
103
|
+
)
|
|
104
|
+
print("Inline display finished.")
|
|
105
|
+
|
|
106
|
+
# --- Example 2: Save the fractal as an SVG file ---
|
|
107
|
+
print("\nGenerating fractal to save as SVG...")
|
|
108
|
+
kf.kececifractals_circle(
|
|
109
|
+
initial_children=7,
|
|
110
|
+
recursive_children=3,
|
|
111
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
112
|
+
max_level=5,
|
|
113
|
+
scale_factor=0.5,
|
|
114
|
+
min_size_factor=0.001,
|
|
115
|
+
base_radius=4.5,
|
|
116
|
+
background_color=(0.95, 0.9, 0.85), # Light beige
|
|
117
|
+
initial_circle_color=(0.3, 0.1, 0.1), # Dark brown
|
|
118
|
+
output_mode='svg',
|
|
119
|
+
filename="kececi_fractal_svg-1" # Will be saved in the notebook's directory
|
|
120
|
+
)
|
|
121
|
+
print("SVG saving finished.")
|
|
122
|
+
|
|
123
|
+
# --- Example 3: Save as PNG with high DPI ---
|
|
124
|
+
print("\nGenerating fractal to save as PNG...")
|
|
125
|
+
kf.kececifractals_circle(
|
|
126
|
+
initial_children=4,
|
|
127
|
+
recursive_children=6,
|
|
128
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
129
|
+
max_level=6, # Deeper recursion
|
|
130
|
+
scale_factor=0.5,
|
|
131
|
+
min_size_factor=0.001, # Smaller details
|
|
132
|
+
output_mode='png',
|
|
133
|
+
filename="kececi_fractal_png-1",
|
|
134
|
+
dpi=400 # High resolution
|
|
135
|
+
)
|
|
136
|
+
print("PNG saving finished.")
|
|
137
|
+
|
|
138
|
+
print("\nGenerating fractal and saving as JPG...")
|
|
139
|
+
kf.kececifractals_circle(
|
|
140
|
+
initial_children=5,
|
|
141
|
+
recursive_children=7,
|
|
142
|
+
text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı",
|
|
143
|
+
max_level=5,
|
|
144
|
+
scale_factor=0.5,
|
|
145
|
+
min_size_factor=0.001,
|
|
146
|
+
output_mode='jpg', # Save as JPG
|
|
147
|
+
filename="kececifractal_jpg-1",
|
|
148
|
+
dpi=300 # Medium resolution JPG
|
|
149
|
+
)
|
|
150
|
+
print("JPG saving finished.")
|
|
151
|
+
|
|
152
|
+
# --- If you modify kececifractals.py and want to reload it ---
|
|
153
|
+
# Without restarting the Jupyter kernel:
|
|
154
|
+
print("\nReloading the module...")
|
|
155
|
+
importlib.reload(kf)
|
|
156
|
+
print("Module reloaded. Now you can run the commands again with the updated code.")
|
|
157
|
+
kf.kececifractals_circle(output_mode='show', text="Keçeci Circle Fractal: Keçeci Dairesel Fraktalı")
|
|
158
|
+
```
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
|
|
167
|
+

|
|
168
|
+
|
|
169
|
+

|
|
170
|
+
|
|
171
|
+

|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## License / Lisans
|
|
179
|
+
|
|
180
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
181
|
+
|
|
182
|
+
## Citation
|
|
183
|
+
|
|
184
|
+
If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.
|
|
185
|
+
|
|
186
|
+
### BibTeX
|
|
187
|
+
|
|
188
|
+
```bibtex
|
|
189
|
+
@misc{kececi_2025_,
|
|
190
|
+
author = {Keçeci, Mehmet},
|
|
191
|
+
title = {kececifractals},
|
|
192
|
+
month = may,
|
|
193
|
+
year = 2025,
|
|
194
|
+
publisher = {PyPI, Anaconda, Github, Zenodo},
|
|
195
|
+
version = {0.1.0},
|
|
196
|
+
doi = {10.5281/zenodo.},
|
|
197
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@misc{kececi_2025_,
|
|
201
|
+
author = {Keçeci, Mehmet},
|
|
202
|
+
title = {Keçeci Fractals},
|
|
203
|
+
month = may,
|
|
204
|
+
year = 2025,
|
|
205
|
+
publisher = {Zenodo},
|
|
206
|
+
version = {0.1.0},
|
|
207
|
+
doi = {10.5281/zenodo.},
|
|
208
|
+
url = {https://doi.org/10.5281/zenodo.},
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### APA
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
Keçeci, M. (2025). kececifractals (0.1.0). PyPI, Anaconda, GitHub, Zenodo. https://doi.org/10.5281/zenodo.
|
|
216
|
+
|
|
217
|
+
Keçeci, M. (2025). kececifractals (0.1.0). GitHub, PyPI, Anaconda, Zenodo. https://doi.org/10.5281/zenodo.
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Chicago
|
|
223
|
+
```
|
|
224
|
+
Keçeci, Mehmet. "kececifractals". PyPI, Anaconda, GitHub, Zenodo, 01 May 2025. https://doi.org/10.5281/zenodo.
|
|
225
|
+
|
|
226
|
+
Keçeci, Mehmet. "kececifractals". GitHub, PyPI, Anaconda, Zenodo, 11 May 2025. https://doi.org/10.5281/zenodo.
|
|
227
|
+
|
|
228
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.cfg
|
|
6
|
+
setup.py
|
|
7
|
+
kececifractals/__init__.py
|
|
8
|
+
kececifractals/_version.py
|
|
9
|
+
kececifractals/kececifractals.py
|
|
10
|
+
kececifractals.egg-info/PKG-INFO
|
|
11
|
+
kececifractals.egg-info/SOURCES.txt
|
|
12
|
+
kececifractals.egg-info/dependency_links.txt
|
|
13
|
+
kececifractals.egg-info/requires.txt
|
|
14
|
+
kececifractals.egg-info/top_level.txt
|
|
15
|
+
tests/test_sample.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
kececifractals
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
name="kececifractals",
|
|
6
|
+
version="0.1.0",
|
|
7
|
+
description="eçeci Fractals: Keçeci-style circle fractal.",
|
|
8
|
+
long_description=open("README.md").read(),
|
|
9
|
+
long_description_content_type="text/markdown",
|
|
10
|
+
author="Mehmet Keçeci",
|
|
11
|
+
maintainer="Mehmet Keçeci",
|
|
12
|
+
author_email="bilginomi@yaani.com",
|
|
13
|
+
maintainer_email="bilginomi@yaani.com",
|
|
14
|
+
url="https://github.com/WhiteSymmetry/kececifractals",
|
|
15
|
+
packages=find_packages(),
|
|
16
|
+
install_requires=[
|
|
17
|
+
"numpy",
|
|
18
|
+
"matplotlib",
|
|
19
|
+
],
|
|
20
|
+
extras_require={
|
|
21
|
+
|
|
22
|
+
},
|
|
23
|
+
classifiers=[
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
],
|
|
28
|
+
python_requires='>=3.9',
|
|
29
|
+
license="MIT",
|
|
30
|
+
)
|