Skip to content

Commit

Permalink
updating readme, demo_1 and some small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seVenVo1d committed Jan 19, 2023
1 parent 64908eb commit 5ec61e3
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 26 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
# GTRPy

GTRPy is a python package that allows you to calculate the well-known tensors in general relativity, without *writing a single line of code*. Furthermore, you can apply many operations to 6 different type of fields, *in both 4D and 3D*.
GTRPy is a python package that allows you to calculate the well-known tensors in General Theory of Relativity, without *writing a single line of code*. Furthermore, you can apply many operations to 6 different type of fields, *in both 4D and 3D*.

> It's tested for GNU/Linux, however it should also work in MacOS. If you ever encounter with a problem, feel free to create an issue.
## Installation
## Installation (via pip)

You can easily install GTRPy via

python3 -m pip install gtrpy

### Requirements

The **base** requirements can be downloaded by running
later on you can install the requirements by running

python3 -m pip install numpy Pillow pysimplegui sympy

However, you also need `tkinter` and `LaTeX` to properly run the GTRPy. In Fedora, these can be easily installed by running
## Installation (via git)

If you want, you can also directly clone the repository via

git clone https://github.com/seVenVo1d/GTRPy.git

and install the requirements by running

python3 -m pip install -r requirements.txt

## Requirements (Extra)

Additionally, you will also need `tkinter` and `LaTeX` to properly run the GTRPy. In Fedora, these can be easily installed by running

sudo dnf install python3-tkinter
sudo dnf install texlive-scheme-full

> Note that *texlive-scheme-full* is about 2-4GB and it may take some time to download.
You can look for your distributions package manager and search for an equivalent installation method.

## User Guide

To start *GTRPy*, simply run
To start GTRPy, simply run

python3 -m gtrpy.run

This will create `logs` directory, which will contain the outputs of the performed operations.
from the terminal (it does not matter what directory you are in).

This will create `logs` directory under your current directory, which will contain the outputs of the performed operations.

Please take a look at the `docs/user_guide.md` for a summary of the GTRPy. To see more detailed examples, you can look at the `demos` directory.
> Please take a look at the `docs/user_guide.md` for a summary of the GTRPy. To see more detailed examples, you can look at the `demos` directory.
## Current Features

Expand Down
48 changes: 47 additions & 1 deletion demos/demo_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,50 @@

In this demo, we will explore the usage of the LaTeX in the GTRPy. By following this tutorial you'll learn how to perform basic mathematical operations and define variables.

> In progress...
## Mathematical Operations and Greek Letters

In GRTPy, the metric tensor and field components can be written by using LaTeX rules. For instance, if you want to write;
$$
\alpha^2(r_s)^3(sin^2(\theta))
$$
you can directly write it as

alpha^2*r_s^3*sin(theta)^2

and the `sympy` will interpret it as it is. In exponential expressions, you can both use `^` and `**`. You can also write `log` as usual, such as `log(10)` etc. For instance, if you want to write;
$$
\log(10)r_s^2\psi^{\eta}
$$
you can directly write it as

log(10)^2*r_s^2*psi^(eta)

As you can see most of the greek alphabet will be converted to its corresponding LaTeX form. Here is the list of them and corresponding results in GTRPy.

$$
{\rm alpha} - \alpha \\
{\rm delta} - \delta \\
{\rm epsilon} - \epsilon \\
{\rm theta} -\theta \\
{\rm iota} - \iota \\
{\rm kappa} - \kappa \\
{\rm lamda} - \lambda \\
{\rm mu} - \mu \\
{\rm nu} - \nu \\
{\rm xi} - \xi \\
{\rm omicron} - \omicron \\
{\rm pi} - \pi \\
{\rm rho} - \rho \\
{\rm sigma} - \sigma \\
{\rm tau} - \tau \\
{\rm upsilon} - \upsilon \\
{\rm phi} - \phi \\
{\rm chi} - \chi \\
{\rm psi} - \psi \\
{\rm omega} - \omega \\
$$

> Note 1: For some reason, `beta` and `gamma` letters do not work in GTRPy. If your calculations involve those letters, please convert them to another letter.
>
> Note 2: You do not need to put `\` in front of the greek letters, as it's done in the LaTeX.
4 changes: 3 additions & 1 deletion docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ You can run the program by simply typing

python3 -m gtrpy.run

from the terminal

![greetings](https://user-images.githubusercontent.com/45866787/213306039-51dd652a-d99e-41b5-9ca9-6fe6a4f7aa35.png)

Later on choose a suitable dimension from the GUI. If you choose four dimensions, you'll see a page in this form
Expand Down Expand Up @@ -38,7 +40,7 @@ and in 3D:
## Tensors, Tensor Types, Index Lowering and Raising

Let us study the Schwarzschild Coordinates as an example.
Let us study the **Schwarzschild Coordinate System** as an example.

![sch](https://user-images.githubusercontent.com/45866787/213306169-1fa3f7fd-20ee-408f-b840-9ad27f26a495.png)

Expand Down
5 changes: 1 addition & 4 deletions gtrpy/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@
from gtrpy.screen.screen3D.mainpage import gtrpy_3d
from gtrpy.screen.screen4D.mainpage import gtrpy_4d


# ========== Creating logs directory ==========
current_directory = os.getcwd()
final_directory = os.path.join(current_directory, r'logs')
if not os.path.exists(final_directory):
os.makedirs(final_directory)


# ========== PySimpleGUI Color Theme ==========
# Color theme option, provided by the PySimpleGUI. You can look at themes from:
# https://www.pysimplegui.org/en/latest/#themes-automatic-coloring-of-your-windows

sg.ChangeLookAndFeel('SandyBeach')


# ========== DIMENSIONS ==========
# ========== Welcome Page ==========
layout_dimension = [
[sg.Text('Welcome to GTRPy', font=('Georgia', 14))],
[sg.Text('Please choose the number of dimensions:', font=('Tahoma', 11)),
Expand Down
3 changes: 1 addition & 2 deletions gtrpy/screen/grtensorsGUI.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import PySimpleGUI as sg

from sympy import preview

from gtrpy.equations.grtensorsEP import *
from gtrpy.tools.image_resizer_grtensor import *


# ========== IMPORTANT VARIABLES ==========


# Turning {'u','d'} tensor type notation into (p, q)
type_dict = {
'(0,2)': 'dd', '(1,1)': 'ud', '(2,0)': 'uu',
Expand Down
2 changes: 0 additions & 2 deletions gtrpy/screen/screen3D/mainpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from gtrpy.screen.screen3D.vectorfieldGUI import *
from gtrpy.screen.screen3D.tensorfieldGUI import *


# ========== INPUT VARIABLES ==========

# GRTensor objects
Expand All @@ -32,7 +31,6 @@
# Image Path
resPATH = importlib.machinery.PathFinder().find_module("gtrpy").get_filename()[:-11] + 'res'


# ========== GTRPy - MAIN PAGE ==========

def gtrpy_3d(coordinate_type='Spherical Coordinates'):
Expand Down
1 change: 1 addition & 0 deletions gtrpy/screen/screen3D/vectorfieldGUI.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import importlib
import PySimpleGUI as sg

from sympy import preview, sympify

from gtrpy.equations.vectorfieldEP import *
Expand Down
2 changes: 0 additions & 2 deletions gtrpy/screen/screen4D/mainpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from gtrpy.screen.screen4D.vectorfieldGUI import *
from gtrpy.screen.screen4D.tensorfieldGUI import *


# ========== INPUT VARIABLES ==========

# GRTensor objects
Expand Down Expand Up @@ -40,7 +39,6 @@
# Image Path
resPATH = importlib.machinery.PathFinder().find_module("gtrpy").get_filename()[:-11] + 'res'


# ========== GTRPy - MAIN PAGE ==========

def gtrpy_4d(coordinate_type='Spherical Coordinates'):
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ build-backend = "hatchling.build"

[project]
name = "gtrpy"
version = "1.3"
version = "1.4"
authors = [
{ name="Arman Çam", email="[email protected]" },
{name="Arman Çam"},
]
description = "GTRPy is a python package that allows you to calculate the well-known tensors in general theory of relativity."
description = "GTRPy is a python package that allows you to calculate the well-known tensors in General Theory of Relativity."
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
Expand Down

0 comments on commit 5ec61e3

Please sign in to comment.