gridshape: A Python module for drawing geometric shapes on a cell matrix with high‑resolution subgrid support, statistical analysis and visualisation.
Project description
# gridshape
**GridShape** – A Python module for drawing geometric shapes on a cell‑matrix with high‑resolution subgrid support, statistical analysis, and rich visualisation.
**GridShape** – Bir hücre matrisi üzerine geometrik şekiller çizmek için yüksek çözünürlüklü alt‑ızgara desteği, istatistiksel analiz ve zengin görselleştirme sunan Python modülü.
---
## Features / Özellikler
- Draw shapes: **rectangle, circle, triangle, diamond, polygon**
Şekil çizimi: **dikdörtgen, daire, üçgen, elmas, çokgen**
- **Cumulative / single shape mode** – add multiple shapes or replace
**Birikimli / tek şekil modu** – çoklu şekil ekle veya değiştir
- **Subgrid mode** – up to 1/2304 cell resolution (48×48 pixels per cell)
**Altızgara modu** – hücre başına 48×48 piksel ile 1/2304 çözünürlüğe kadar
- **Rotation** – rotate the last shape in subgrid mode
**Döndürme** – altızgara modunda son şekli döndür
- **Advanced statistics** – sum, mean, standard deviation, min, max, median for shape cells, background, and whole matrix
**Gelişmiş istatistikler** – şekil, arka plan ve tüm matris için toplam, ortalama, standart sapma, min, max, medyan
- **Export** – CSV data and formatted text report
**Dışa aktarma** – CSV verisi ve biçimlendirilmiş metin raporu
- **Visualisation** – custom colour map, grid lines, cell numbers, axis ticks
**Görselleştirme** – özel renk haritası, ızgara çizgileri, hücre numaraları, eksen işaretleri
- **Interactive console menu** – easy to use without coding
**Etkileşimli konsol menüsü** – kod yazmadan kolay kullanım
---
## Installation / Kurulum
The module is a single Python file. No external dependencies except **matplotlib** and **numpy**.
Modül tek bir Python dosyasıdır. **matplotlib** ve **numpy** dışında harici bağımlılığı yoktur.
```bash
pip install gridshape
Place gridshape.py in your project folder or Python path.
gridshape.py dosyasını proje klasörünüze veya Python yoluna koyun.
Usage / Kullanım
from gridshape import GridShape
import matplotlib.pyplot as plt
g = GridShape(outer_size=10)
g.generate_shape('square', {'row': 5, 'col': 5, 'h': 3, 'w': 3})
g.visualize()
plt.show()
Run the interactive menu:
Etkileşimli menüyü başlatın:
from gridshape import GridShape
# Interaktif menüyü başlatmak için:
GridShape.run_interactive()
Basic workflow / Temel iş akışı
-
Set matrix size (e.g. 10×10)
Matris boyutunu ayarlayın (ör. 10×10) -
Choose background colour
Arka plan rengini seçin -
Select shape type (1‑5) and enter parameters
Şekil tipini (1‑5) seçin ve parametreleri girin -
View the cell matrix, statistics, and plot
Hücre matrisini, istatistikleri ve çizimi görüntüleyin -
Switch to subgrid mode (
S) for higher precision
Daha yüksek hassasiyet için altızgara moduna (S) geçin -
Rotate the last shape (
7) – subgrid only
Son şekli döndürün (7) – sadece altızgara modunda -
Export data automatically (CSV + TXT report)
Veriler otomatik dışa aktarılır (CSV + TXT rapor)
Class Reference / Sınıf Referansı
GridShape(outer_size=10, sub_res=48)
- outer_size – number of cells per row/column (default 10)
satır/sütun başına hücre sayısı - sub_res – sub‑divisions per cell (default 48 → 2304 sub‑cells)
hücre başına alt bölüm sayısı
Main methods / Ana metotlar
| Method | Description / Açıklama |
|---|---|
create_shape(shape_type, params) |
adds a shape to the history / şekli geçmişe ekler |
rotate_last_shape(angle, center_row, center_col) |
rotates last shape (subgrid only) / son şekli döndürür (sadece altızgara) |
get_advanced_stats() |
returns detailed statistics / detaylı istatistik döndürür |
export_data(stats) |
saves CSV and report files / CSV ve rapor dosyalarını kaydeder |
visualize(show_nums, show_grid, show_ticks) |
displays the plot / grafiği gösterir |
Shape parameters / Şekil parametreleri
| Shape | Required parameters / Gerekli parametreler |
|---|---|
| Rectangle | row, col, h, w |
| Circle | row, col, radius |
| Triangle | row, col, size |
| Diamond | row, col, size |
| Polygon | coords (list of (row, col) tuples) |
All positions are 1‑indexed (row 1..N, column 1..N).
Tüm konumlar 1‑tabanlıdır (satır 1..N, sütun 1..N).
Output Files / Çıktı Dosyaları
matris_data.csv– each matrix cell (row, column, value, inside_shape)
her matris hücresi (satır, sütun, değer, şekil içinde mi)matris_raporu.txt– full statistical report with a visual matrix
tam istatistik raporu ve görsel matrisgrid_YYYYMMDD_HHMMSS.png– saved plot (user requested)
kaydedilmiş grafik (kullanıcı istediğinde)
Example / Örnek
Draw a 4×4 square at position (4,4) and rotate it 45° around cell (5,5):
(4,4) konumunda 4×4 bir kare çizin ve (5,5) hücresi etrafında 45° döndürün:
Matris Boyutu: 10
Arka Plan: 1
Subgrid aç (S)
Şekil 1 (Kare) → row=4, col=4, h=4, w=4
Şekil 7 (Döndür) → center row=5, col=5, angle=45
The resulting shape will be a diamond covering about 31 cells.
Sonuç şekil yaklaşık 31 hücre kaplayan bir elmas olacaktır.
License / Lisans
AGPL3.0-or-later License
Author / Yazar
Developed for educational and simulation purposes.
Eğitim ve simülasyon amaçlı geliştirilmiştir.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gridshape-0.1.1.tar.gz.
File metadata
- Download URL: gridshape-0.1.1.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c2d117a67dcc10a83734fe41701c91981579c11269a6e436513572eb9d3e950
|
|
| MD5 |
93443d318ec17b06eec9f630edf5b7a0
|
|
| BLAKE2b-256 |
ffc446ac4ddb339e5a5b1365fc94188ab49541c5aaf7e18714d7a6ef7bbfe7db
|
Provenance
The following attestation bundles were made for gridshape-0.1.1.tar.gz:
Publisher:
workflow.yml on WhiteSymmetry/gridshape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gridshape-0.1.1.tar.gz -
Subject digest:
4c2d117a67dcc10a83734fe41701c91981579c11269a6e436513572eb9d3e950 - Sigstore transparency entry: 1438890291
- Sigstore integration time:
-
Permalink:
WhiteSymmetry/gridshape@07d36a346037e558c4c6da50b86021fd3c88b061 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/WhiteSymmetry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@07d36a346037e558c4c6da50b86021fd3c88b061 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gridshape-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gridshape-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9986c52ae48c07f54ec40ecfb86aee21e198e28b87e05aa6f2eaa18ffcb35d4a
|
|
| MD5 |
7b80acd0b5db341060e809bb63e03676
|
|
| BLAKE2b-256 |
49bd9c225ea0c56dc25accf0ae220a5e74ee3513853a32b70740bc68d7fd4ba7
|
Provenance
The following attestation bundles were made for gridshape-0.1.1-py3-none-any.whl:
Publisher:
workflow.yml on WhiteSymmetry/gridshape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gridshape-0.1.1-py3-none-any.whl -
Subject digest:
9986c52ae48c07f54ec40ecfb86aee21e198e28b87e05aa6f2eaa18ffcb35d4a - Sigstore transparency entry: 1438890311
- Sigstore integration time:
-
Permalink:
WhiteSymmetry/gridshape@07d36a346037e558c4c6da50b86021fd3c88b061 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/WhiteSymmetry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@07d36a346037e558c4c6da50b86021fd3c88b061 -
Trigger Event:
push
-
Statement type: