meafs 0.0.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Matheus J. Castro
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.
meafs-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.1
2
+ Name: meafs
3
+ Version: 0.0.1
4
+ Summary: Multiple Element Abundance Fit Software
5
+ Author: Matheus J. Castro
6
+ Project-URL: Homepage, https://github.com/MatheusJCastro/meafs
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.txt
13
+ Requires-Dist: astropy
14
+ Requires-Dist: specutils
15
+ Requires-Dist: scipy
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: pandas
18
+ Requires-Dist: numpy
19
+ Requires-Dist: desktop_file
20
+ Requires-Dist: pathlib
21
+ Requires-Dist: PyQt6
22
+ Requires-Dist: dill
23
+
24
+ ![Meafs Logo](meafs_code/images/Meafs_Logo.png)
25
+
26
+ # Multiple Element Abundance Fit Software - MEAFS
27
+
28
+ *Written by: Matheus J. Castro*
29
+ *Under MIT License*
30
+
31
+ <hr/>
32
+ <hr/>
33
+
34
+ ## Table of Contents
35
+
36
+ 1. [Aims](#Aims)
37
+ 2. [Prerequisites](#Prerequisites)
38
+ 3. [Instalation](#Instalation)
39
+ 1. [Creating Anaconda Environment (recommended)](<#creating-anaconda-environment-recommended>)
40
+ 2. [Getting the pip version (recommended)](<#getting-the-pip-version-recommended-not-yet-working>)
41
+ 3. [Cloning from GitHub](<#cloning-from-github>)
42
+ 4. [Adding the PATH (for non Anaconda installations)](<#adding-the-path-for-non-anaconda-installations>)
43
+ 5. [Step-by-Step for Windows (Python + GCC)](<#step-by-step-for-windows-python--gcc>)
44
+ 6. [Compilation](<#compilation>)
45
+ 4. [Usage](#Usage)
46
+ 1. [With Installation](<#with-installation>)
47
+ 2. [Without Installation](<#without-installation>)
48
+ 3. [Flags and Arguments](<#flags-and-arguments>)
49
+ 4. [Auto Save](<#auto-save>)
50
+ 5. [Uninstall](#Uninstall)
51
+
52
+ ## Aims
53
+
54
+ The MEAFS is a fitting tool software for spectra abundance analysis. The aims is to provide a medium to high analysis for each individual absorption line in a given spectrum.
55
+ The software also fits the wavelength shift, continuum and convolution of the spectrum.
56
+
57
+ ![Meafs GUI](meafs_code/images/Meafs_Gui.png)
58
+
59
+ ## Prerequisites
60
+
61
+ - Python3 and GCC needs to be previously installed in the system (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>));
62
+
63
+ - A software for creating a synthetic spectrum also needs to be previously installed. This version of MEAFS is compatible with the following softwares:
64
+ - Turbospectrum2019: [https://github.com/bertrandplez/Turbospectrum2019](https://github.com/bertrandplez/Turbospectrum2019)
65
+
66
+ - Optionally: to execute the `unify_plots.py`, a LaTeX installation must be present on the system.
67
+
68
+ - Optionally: [Anaconda](<#creating-anaconda-environment-recommended>).
69
+
70
+ ## Instalation
71
+
72
+ There are many options to run MEAFS. We strongly recommend the use of Anaconda environment, but it is not mandatory.
73
+ You can install it from pip or run directly the source code from the repository.
74
+
75
+ All the methods listed below work in Linux, Windows or MacOS **if you have python and gcc installed** (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>)).
76
+
77
+ ### Creating Anaconda Environment (recommended)
78
+ - First, download anaconda [here](https://www.anaconda.com/products/individual#download-section) and execute the script.
79
+
80
+ - For Linux users, if needed, export anaconda to your path by adding the line `export PATH="/home/USERNAME/anaconda3/bin:$PATH"` (changing the `USERNAME` to your user) to the `~/.bashrc` file. Close and open a new terminal to update the path.
81
+
82
+ - If desirable, disable autoactivation of anaconda with `conda config --set auto_activate_base false`.
83
+
84
+ - Create MEAFS enviroment with `conda create python -n meafs`;
85
+
86
+ - Then, to activate the environment, type `conda activate meafs`;
87
+
88
+ ### Getting the pip version (recommended) (not yet working)
89
+
90
+ <s>
91
+ You can easily get the pip version by typing in the terminal:
92
+
93
+ #```bash
94
+ #pip install meafs
95
+ #```
96
+
97
+ </s>
98
+
99
+ ### Cloning from GitHub
100
+
101
+ Or you can directly clone from the GitHub page with:
102
+
103
+ ```bash
104
+ git clone https://github.com/MatheusJCastro/meafs.git
105
+ ```
106
+
107
+ After cloning, you can install it with pip or run without any installation at all (see the [Usage](<#without-installation>) section).
108
+
109
+ To build the package and install it with pip from the source, first install the `build` package:
110
+
111
+ ```bash
112
+ pip install build
113
+ ```
114
+
115
+ Then go to the MEAFS source code directory and type:
116
+
117
+ ```bash
118
+ python3 -m build
119
+ pip install .
120
+ ```
121
+
122
+ ### Adding the PATH (for non Anaconda installations)
123
+ If you do not use Anaconda, you need to add the path of the pip scripts into the system path variable if you have not already done so.
124
+ **This step is not necessary if you are running without installation.**
125
+
126
+ #### Linux
127
+ For Linux users, you can add the following line in the end of the file `~/.bashrc`, changing `USER` to your own user.
128
+
129
+ ```bash
130
+ export PATH="${PATH}:/home/USER/.local/bin/"
131
+ ```
132
+
133
+ For some Linux distributions and Python installations, the locale of the executables can slightly change. If this does not work out, you can try differents paths such as `/usr/local/bin` and others.
134
+
135
+ #### Windows
136
+
137
+ For Windows users, you need to open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add a new line with one of the followings (check the python location first):
138
+
139
+ ```bash
140
+ C:\Users\Windows\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts
141
+ ```
142
+
143
+ Or:
144
+
145
+ ```bash
146
+ C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts
147
+ ```
148
+
149
+ **Be aware of different Python versions, the path will change also. Always verify if the current path exists.**
150
+
151
+ ### Step-by-Step for Windows (Python + GCC)
152
+ Obs: this step-by-step guide was made using a fresh new install of Windows 10.
153
+
154
+ #### Python
155
+
156
+ Go to [Python Windows Releases](https://www.python.org/downloads/windows/) and download an stable release by clicking on it and downloading the *Windows installer (64-bit) Recommended*. After downloading, exectue the files and follow the installation process.
157
+
158
+ - Add the Python folder to the path.
159
+ - Open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add two new lines:
160
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`
161
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts`
162
+ - Change `USERNAME` with your username and `Python311` to the actual version that you installed.
163
+ - Go to the python folder (ex: `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`) and create a copy of the `python.exe` file in the same location with the name `python3.11.exe`
164
+
165
+ #### GCC
166
+
167
+ Download the *x64* version of [Winlibs](https://winlibs.com).
168
+
169
+ - Choose the x64 MCF **with** all the libraries;
170
+ - After downloading, decompress the file and move the `mingw64` folder to `C:\Program Files\`;
171
+ - Now add the folder `bin` of the `mingw64` folder to the path:
172
+ - Use the sames steps as before but now add the line: `C:\Program Files\mingw64\bin`.
173
+
174
+ ### Compilation
175
+
176
+ There is one file written in C Language (`meafs/meafs_code/scripts/bisec_interpol.c`), the compilation directives can be found in the `meafs/meafs_code/scripts/comp.sh`. The C file needs to be compiled as a shared library, when using *GCC Compiler*, this can be achieved by adding the `-shared` flag.
177
+
178
+ For Linux users just add execution privileges at the `comp.sh` file and execute it in a terminal to create the binary. For that, open a terminal in the `meafs/meafs_code/scripts/` folder and type:
179
+
180
+ ```bash
181
+ chmod +x comp.sh
182
+ ./comp.sh
183
+ ```
184
+
185
+ ## Usage
186
+
187
+ ### With Installation
188
+ You can create menu entries for MEAFS by typing in the terminal or cmd:
189
+
190
+ ```bash
191
+ meafs-desktop-create
192
+ ```
193
+
194
+ Then, search in the menu for *MEAFS*, and in Windows, a Desktop link will also be created.
195
+ But, if you do not want to create menu entries, just type `meafs` or `python -m meafs` in the terminal or cmd to launch it.
196
+
197
+ ### Without Installation
198
+ Simply execute the file `gui.py` and it will power the GUI.
199
+
200
+ ### Flags and Arguments
201
+
202
+ There are some flags that can be passed with the command-line.
203
+
204
+ - `-h` or `--help`: Show the help section;
205
+ - `-v` or `--version`: Show version number;
206
+ - `-l` or `--last`: Load the last closed session. Default location is `meafs_code/auto_save_last.pkl`
207
+ - `-s` or `--load-auto-save`: Load the auto saved session. Default location is: `meafs_code/auto_save.pkl`
208
+
209
+ Also, any saved section can be passed as an argument. It will power the GUI with it. If no argument is given, the GUI will power with a new empty session.
210
+
211
+ ### Auto Save
212
+ In the *File* menu there is an *Auto Save* option. When checked, MEAFS will save the session every 5 seconds in a file named `auto_save.pkl`.
213
+ Also, if auto save is enabled, when MEAFS is closed, it will save the session in the `auto_save_last.pkl` file.
214
+ These files are located under the MEAFS directory and the `-h` [flag](<#flags-and-arguments>) will show the location.
215
+ To load any of these files, simply use the [flags](<#flags-and-arguments>) or load them in the *File* - *Open...* menu
216
+
217
+ ## Uninstall
218
+
219
+ If you did not install with pip (both directly or by cloning), you can just erase the *meafs* folder.
220
+
221
+ Otherwise, first remove the menu entries (if you have added it) and then uninstall:
222
+
223
+ ```bash
224
+ meafs-desktop-remove
225
+ pip uninstall meafs
226
+ ```
227
+
228
+ <hr/>
meafs-0.0.1/README.md ADDED
@@ -0,0 +1,205 @@
1
+ ![Meafs Logo](meafs_code/images/Meafs_Logo.png)
2
+
3
+ # Multiple Element Abundance Fit Software - MEAFS
4
+
5
+ *Written by: Matheus J. Castro*
6
+ *Under MIT License*
7
+
8
+ <hr/>
9
+ <hr/>
10
+
11
+ ## Table of Contents
12
+
13
+ 1. [Aims](#Aims)
14
+ 2. [Prerequisites](#Prerequisites)
15
+ 3. [Instalation](#Instalation)
16
+ 1. [Creating Anaconda Environment (recommended)](<#creating-anaconda-environment-recommended>)
17
+ 2. [Getting the pip version (recommended)](<#getting-the-pip-version-recommended-not-yet-working>)
18
+ 3. [Cloning from GitHub](<#cloning-from-github>)
19
+ 4. [Adding the PATH (for non Anaconda installations)](<#adding-the-path-for-non-anaconda-installations>)
20
+ 5. [Step-by-Step for Windows (Python + GCC)](<#step-by-step-for-windows-python--gcc>)
21
+ 6. [Compilation](<#compilation>)
22
+ 4. [Usage](#Usage)
23
+ 1. [With Installation](<#with-installation>)
24
+ 2. [Without Installation](<#without-installation>)
25
+ 3. [Flags and Arguments](<#flags-and-arguments>)
26
+ 4. [Auto Save](<#auto-save>)
27
+ 5. [Uninstall](#Uninstall)
28
+
29
+ ## Aims
30
+
31
+ The MEAFS is a fitting tool software for spectra abundance analysis. The aims is to provide a medium to high analysis for each individual absorption line in a given spectrum.
32
+ The software also fits the wavelength shift, continuum and convolution of the spectrum.
33
+
34
+ ![Meafs GUI](meafs_code/images/Meafs_Gui.png)
35
+
36
+ ## Prerequisites
37
+
38
+ - Python3 and GCC needs to be previously installed in the system (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>));
39
+
40
+ - A software for creating a synthetic spectrum also needs to be previously installed. This version of MEAFS is compatible with the following softwares:
41
+ - Turbospectrum2019: [https://github.com/bertrandplez/Turbospectrum2019](https://github.com/bertrandplez/Turbospectrum2019)
42
+
43
+ - Optionally: to execute the `unify_plots.py`, a LaTeX installation must be present on the system.
44
+
45
+ - Optionally: [Anaconda](<#creating-anaconda-environment-recommended>).
46
+
47
+ ## Instalation
48
+
49
+ There are many options to run MEAFS. We strongly recommend the use of Anaconda environment, but it is not mandatory.
50
+ You can install it from pip or run directly the source code from the repository.
51
+
52
+ All the methods listed below work in Linux, Windows or MacOS **if you have python and gcc installed** (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>)).
53
+
54
+ ### Creating Anaconda Environment (recommended)
55
+ - First, download anaconda [here](https://www.anaconda.com/products/individual#download-section) and execute the script.
56
+
57
+ - For Linux users, if needed, export anaconda to your path by adding the line `export PATH="/home/USERNAME/anaconda3/bin:$PATH"` (changing the `USERNAME` to your user) to the `~/.bashrc` file. Close and open a new terminal to update the path.
58
+
59
+ - If desirable, disable autoactivation of anaconda with `conda config --set auto_activate_base false`.
60
+
61
+ - Create MEAFS enviroment with `conda create python -n meafs`;
62
+
63
+ - Then, to activate the environment, type `conda activate meafs`;
64
+
65
+ ### Getting the pip version (recommended) (not yet working)
66
+
67
+ <s>
68
+ You can easily get the pip version by typing in the terminal:
69
+
70
+ #```bash
71
+ #pip install meafs
72
+ #```
73
+
74
+ </s>
75
+
76
+ ### Cloning from GitHub
77
+
78
+ Or you can directly clone from the GitHub page with:
79
+
80
+ ```bash
81
+ git clone https://github.com/MatheusJCastro/meafs.git
82
+ ```
83
+
84
+ After cloning, you can install it with pip or run without any installation at all (see the [Usage](<#without-installation>) section).
85
+
86
+ To build the package and install it with pip from the source, first install the `build` package:
87
+
88
+ ```bash
89
+ pip install build
90
+ ```
91
+
92
+ Then go to the MEAFS source code directory and type:
93
+
94
+ ```bash
95
+ python3 -m build
96
+ pip install .
97
+ ```
98
+
99
+ ### Adding the PATH (for non Anaconda installations)
100
+ If you do not use Anaconda, you need to add the path of the pip scripts into the system path variable if you have not already done so.
101
+ **This step is not necessary if you are running without installation.**
102
+
103
+ #### Linux
104
+ For Linux users, you can add the following line in the end of the file `~/.bashrc`, changing `USER` to your own user.
105
+
106
+ ```bash
107
+ export PATH="${PATH}:/home/USER/.local/bin/"
108
+ ```
109
+
110
+ For some Linux distributions and Python installations, the locale of the executables can slightly change. If this does not work out, you can try differents paths such as `/usr/local/bin` and others.
111
+
112
+ #### Windows
113
+
114
+ For Windows users, you need to open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add a new line with one of the followings (check the python location first):
115
+
116
+ ```bash
117
+ C:\Users\Windows\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts
118
+ ```
119
+
120
+ Or:
121
+
122
+ ```bash
123
+ C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts
124
+ ```
125
+
126
+ **Be aware of different Python versions, the path will change also. Always verify if the current path exists.**
127
+
128
+ ### Step-by-Step for Windows (Python + GCC)
129
+ Obs: this step-by-step guide was made using a fresh new install of Windows 10.
130
+
131
+ #### Python
132
+
133
+ Go to [Python Windows Releases](https://www.python.org/downloads/windows/) and download an stable release by clicking on it and downloading the *Windows installer (64-bit) Recommended*. After downloading, exectue the files and follow the installation process.
134
+
135
+ - Add the Python folder to the path.
136
+ - Open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add two new lines:
137
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`
138
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts`
139
+ - Change `USERNAME` with your username and `Python311` to the actual version that you installed.
140
+ - Go to the python folder (ex: `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`) and create a copy of the `python.exe` file in the same location with the name `python3.11.exe`
141
+
142
+ #### GCC
143
+
144
+ Download the *x64* version of [Winlibs](https://winlibs.com).
145
+
146
+ - Choose the x64 MCF **with** all the libraries;
147
+ - After downloading, decompress the file and move the `mingw64` folder to `C:\Program Files\`;
148
+ - Now add the folder `bin` of the `mingw64` folder to the path:
149
+ - Use the sames steps as before but now add the line: `C:\Program Files\mingw64\bin`.
150
+
151
+ ### Compilation
152
+
153
+ There is one file written in C Language (`meafs/meafs_code/scripts/bisec_interpol.c`), the compilation directives can be found in the `meafs/meafs_code/scripts/comp.sh`. The C file needs to be compiled as a shared library, when using *GCC Compiler*, this can be achieved by adding the `-shared` flag.
154
+
155
+ For Linux users just add execution privileges at the `comp.sh` file and execute it in a terminal to create the binary. For that, open a terminal in the `meafs/meafs_code/scripts/` folder and type:
156
+
157
+ ```bash
158
+ chmod +x comp.sh
159
+ ./comp.sh
160
+ ```
161
+
162
+ ## Usage
163
+
164
+ ### With Installation
165
+ You can create menu entries for MEAFS by typing in the terminal or cmd:
166
+
167
+ ```bash
168
+ meafs-desktop-create
169
+ ```
170
+
171
+ Then, search in the menu for *MEAFS*, and in Windows, a Desktop link will also be created.
172
+ But, if you do not want to create menu entries, just type `meafs` or `python -m meafs` in the terminal or cmd to launch it.
173
+
174
+ ### Without Installation
175
+ Simply execute the file `gui.py` and it will power the GUI.
176
+
177
+ ### Flags and Arguments
178
+
179
+ There are some flags that can be passed with the command-line.
180
+
181
+ - `-h` or `--help`: Show the help section;
182
+ - `-v` or `--version`: Show version number;
183
+ - `-l` or `--last`: Load the last closed session. Default location is `meafs_code/auto_save_last.pkl`
184
+ - `-s` or `--load-auto-save`: Load the auto saved session. Default location is: `meafs_code/auto_save.pkl`
185
+
186
+ Also, any saved section can be passed as an argument. It will power the GUI with it. If no argument is given, the GUI will power with a new empty session.
187
+
188
+ ### Auto Save
189
+ In the *File* menu there is an *Auto Save* option. When checked, MEAFS will save the session every 5 seconds in a file named `auto_save.pkl`.
190
+ Also, if auto save is enabled, when MEAFS is closed, it will save the session in the `auto_save_last.pkl` file.
191
+ These files are located under the MEAFS directory and the `-h` [flag](<#flags-and-arguments>) will show the location.
192
+ To load any of these files, simply use the [flags](<#flags-and-arguments>) or load them in the *File* - *Open...* menu
193
+
194
+ ## Uninstall
195
+
196
+ If you did not install with pip (both directly or by cloning), you can just erase the *meafs* folder.
197
+
198
+ Otherwise, first remove the menu entries (if you have added it) and then uninstall:
199
+
200
+ ```bash
201
+ meafs-desktop-remove
202
+ pip uninstall meafs
203
+ ```
204
+
205
+ <hr/>
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.1
2
+ Name: meafs
3
+ Version: 0.0.1
4
+ Summary: Multiple Element Abundance Fit Software
5
+ Author: Matheus J. Castro
6
+ Project-URL: Homepage, https://github.com/MatheusJCastro/meafs
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.txt
13
+ Requires-Dist: astropy
14
+ Requires-Dist: specutils
15
+ Requires-Dist: scipy
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: pandas
18
+ Requires-Dist: numpy
19
+ Requires-Dist: desktop_file
20
+ Requires-Dist: pathlib
21
+ Requires-Dist: PyQt6
22
+ Requires-Dist: dill
23
+
24
+ ![Meafs Logo](meafs_code/images/Meafs_Logo.png)
25
+
26
+ # Multiple Element Abundance Fit Software - MEAFS
27
+
28
+ *Written by: Matheus J. Castro*
29
+ *Under MIT License*
30
+
31
+ <hr/>
32
+ <hr/>
33
+
34
+ ## Table of Contents
35
+
36
+ 1. [Aims](#Aims)
37
+ 2. [Prerequisites](#Prerequisites)
38
+ 3. [Instalation](#Instalation)
39
+ 1. [Creating Anaconda Environment (recommended)](<#creating-anaconda-environment-recommended>)
40
+ 2. [Getting the pip version (recommended)](<#getting-the-pip-version-recommended-not-yet-working>)
41
+ 3. [Cloning from GitHub](<#cloning-from-github>)
42
+ 4. [Adding the PATH (for non Anaconda installations)](<#adding-the-path-for-non-anaconda-installations>)
43
+ 5. [Step-by-Step for Windows (Python + GCC)](<#step-by-step-for-windows-python--gcc>)
44
+ 6. [Compilation](<#compilation>)
45
+ 4. [Usage](#Usage)
46
+ 1. [With Installation](<#with-installation>)
47
+ 2. [Without Installation](<#without-installation>)
48
+ 3. [Flags and Arguments](<#flags-and-arguments>)
49
+ 4. [Auto Save](<#auto-save>)
50
+ 5. [Uninstall](#Uninstall)
51
+
52
+ ## Aims
53
+
54
+ The MEAFS is a fitting tool software for spectra abundance analysis. The aims is to provide a medium to high analysis for each individual absorption line in a given spectrum.
55
+ The software also fits the wavelength shift, continuum and convolution of the spectrum.
56
+
57
+ ![Meafs GUI](meafs_code/images/Meafs_Gui.png)
58
+
59
+ ## Prerequisites
60
+
61
+ - Python3 and GCC needs to be previously installed in the system (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>));
62
+
63
+ - A software for creating a synthetic spectrum also needs to be previously installed. This version of MEAFS is compatible with the following softwares:
64
+ - Turbospectrum2019: [https://github.com/bertrandplez/Turbospectrum2019](https://github.com/bertrandplez/Turbospectrum2019)
65
+
66
+ - Optionally: to execute the `unify_plots.py`, a LaTeX installation must be present on the system.
67
+
68
+ - Optionally: [Anaconda](<#creating-anaconda-environment-recommended>).
69
+
70
+ ## Instalation
71
+
72
+ There are many options to run MEAFS. We strongly recommend the use of Anaconda environment, but it is not mandatory.
73
+ You can install it from pip or run directly the source code from the repository.
74
+
75
+ All the methods listed below work in Linux, Windows or MacOS **if you have python and gcc installed** (step-by-step to install for Windows users [bellow](<#step-by-step-for-windows-python--gcc>)).
76
+
77
+ ### Creating Anaconda Environment (recommended)
78
+ - First, download anaconda [here](https://www.anaconda.com/products/individual#download-section) and execute the script.
79
+
80
+ - For Linux users, if needed, export anaconda to your path by adding the line `export PATH="/home/USERNAME/anaconda3/bin:$PATH"` (changing the `USERNAME` to your user) to the `~/.bashrc` file. Close and open a new terminal to update the path.
81
+
82
+ - If desirable, disable autoactivation of anaconda with `conda config --set auto_activate_base false`.
83
+
84
+ - Create MEAFS enviroment with `conda create python -n meafs`;
85
+
86
+ - Then, to activate the environment, type `conda activate meafs`;
87
+
88
+ ### Getting the pip version (recommended) (not yet working)
89
+
90
+ <s>
91
+ You can easily get the pip version by typing in the terminal:
92
+
93
+ #```bash
94
+ #pip install meafs
95
+ #```
96
+
97
+ </s>
98
+
99
+ ### Cloning from GitHub
100
+
101
+ Or you can directly clone from the GitHub page with:
102
+
103
+ ```bash
104
+ git clone https://github.com/MatheusJCastro/meafs.git
105
+ ```
106
+
107
+ After cloning, you can install it with pip or run without any installation at all (see the [Usage](<#without-installation>) section).
108
+
109
+ To build the package and install it with pip from the source, first install the `build` package:
110
+
111
+ ```bash
112
+ pip install build
113
+ ```
114
+
115
+ Then go to the MEAFS source code directory and type:
116
+
117
+ ```bash
118
+ python3 -m build
119
+ pip install .
120
+ ```
121
+
122
+ ### Adding the PATH (for non Anaconda installations)
123
+ If you do not use Anaconda, you need to add the path of the pip scripts into the system path variable if you have not already done so.
124
+ **This step is not necessary if you are running without installation.**
125
+
126
+ #### Linux
127
+ For Linux users, you can add the following line in the end of the file `~/.bashrc`, changing `USER` to your own user.
128
+
129
+ ```bash
130
+ export PATH="${PATH}:/home/USER/.local/bin/"
131
+ ```
132
+
133
+ For some Linux distributions and Python installations, the locale of the executables can slightly change. If this does not work out, you can try differents paths such as `/usr/local/bin` and others.
134
+
135
+ #### Windows
136
+
137
+ For Windows users, you need to open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add a new line with one of the followings (check the python location first):
138
+
139
+ ```bash
140
+ C:\Users\Windows\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts
141
+ ```
142
+
143
+ Or:
144
+
145
+ ```bash
146
+ C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts
147
+ ```
148
+
149
+ **Be aware of different Python versions, the path will change also. Always verify if the current path exists.**
150
+
151
+ ### Step-by-Step for Windows (Python + GCC)
152
+ Obs: this step-by-step guide was made using a fresh new install of Windows 10.
153
+
154
+ #### Python
155
+
156
+ Go to [Python Windows Releases](https://www.python.org/downloads/windows/) and download an stable release by clicking on it and downloading the *Windows installer (64-bit) Recommended*. After downloading, exectue the files and follow the installation process.
157
+
158
+ - Add the Python folder to the path.
159
+ - Open the menu and search for *path*, click in *Edit the system environment variables*, at the bottom right click in *Environment Variables...*, in the tab *System variables* (attention: not the *User variables for Username*), look for the variable *Path* and click on *Edit*. Add two new lines:
160
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`
161
+ - `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311\Scripts`
162
+ - Change `USERNAME` with your username and `Python311` to the actual version that you installed.
163
+ - Go to the python folder (ex: `C:\Users\USERNAME\AppData\Local\Programs\Python\Python311`) and create a copy of the `python.exe` file in the same location with the name `python3.11.exe`
164
+
165
+ #### GCC
166
+
167
+ Download the *x64* version of [Winlibs](https://winlibs.com).
168
+
169
+ - Choose the x64 MCF **with** all the libraries;
170
+ - After downloading, decompress the file and move the `mingw64` folder to `C:\Program Files\`;
171
+ - Now add the folder `bin` of the `mingw64` folder to the path:
172
+ - Use the sames steps as before but now add the line: `C:\Program Files\mingw64\bin`.
173
+
174
+ ### Compilation
175
+
176
+ There is one file written in C Language (`meafs/meafs_code/scripts/bisec_interpol.c`), the compilation directives can be found in the `meafs/meafs_code/scripts/comp.sh`. The C file needs to be compiled as a shared library, when using *GCC Compiler*, this can be achieved by adding the `-shared` flag.
177
+
178
+ For Linux users just add execution privileges at the `comp.sh` file and execute it in a terminal to create the binary. For that, open a terminal in the `meafs/meafs_code/scripts/` folder and type:
179
+
180
+ ```bash
181
+ chmod +x comp.sh
182
+ ./comp.sh
183
+ ```
184
+
185
+ ## Usage
186
+
187
+ ### With Installation
188
+ You can create menu entries for MEAFS by typing in the terminal or cmd:
189
+
190
+ ```bash
191
+ meafs-desktop-create
192
+ ```
193
+
194
+ Then, search in the menu for *MEAFS*, and in Windows, a Desktop link will also be created.
195
+ But, if you do not want to create menu entries, just type `meafs` or `python -m meafs` in the terminal or cmd to launch it.
196
+
197
+ ### Without Installation
198
+ Simply execute the file `gui.py` and it will power the GUI.
199
+
200
+ ### Flags and Arguments
201
+
202
+ There are some flags that can be passed with the command-line.
203
+
204
+ - `-h` or `--help`: Show the help section;
205
+ - `-v` or `--version`: Show version number;
206
+ - `-l` or `--last`: Load the last closed session. Default location is `meafs_code/auto_save_last.pkl`
207
+ - `-s` or `--load-auto-save`: Load the auto saved session. Default location is: `meafs_code/auto_save.pkl`
208
+
209
+ Also, any saved section can be passed as an argument. It will power the GUI with it. If no argument is given, the GUI will power with a new empty session.
210
+
211
+ ### Auto Save
212
+ In the *File* menu there is an *Auto Save* option. When checked, MEAFS will save the session every 5 seconds in a file named `auto_save.pkl`.
213
+ Also, if auto save is enabled, when MEAFS is closed, it will save the session in the `auto_save_last.pkl` file.
214
+ These files are located under the MEAFS directory and the `-h` [flag](<#flags-and-arguments>) will show the location.
215
+ To load any of these files, simply use the [flags](<#flags-and-arguments>) or load them in the *File* - *Open...* menu
216
+
217
+ ## Uninstall
218
+
219
+ If you did not install with pip (both directly or by cloning), you can just erase the *meafs* folder.
220
+
221
+ Otherwise, first remove the menu entries (if you have added it) and then uninstall:
222
+
223
+ ```bash
224
+ meafs-desktop-remove
225
+ pip uninstall meafs
226
+ ```
227
+
228
+ <hr/>
@@ -0,0 +1,9 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ meafs.egg-info/PKG-INFO
5
+ meafs.egg-info/SOURCES.txt
6
+ meafs.egg-info/dependency_links.txt
7
+ meafs.egg-info/entry_points.txt
8
+ meafs.egg-info/requires.txt
9
+ meafs.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ meafs = meafs_code.gui:main
3
+ meafs-desktop-create = meafs_code.desktop_entry:create
4
+ meafs-desktop-remove = meafs_code.desktop_entry:remove
@@ -0,0 +1,10 @@
1
+ astropy
2
+ specutils
3
+ scipy
4
+ matplotlib
5
+ pandas
6
+ numpy
7
+ desktop_file
8
+ pathlib
9
+ PyQt6
10
+ dill
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,36 @@
1
+ [project]
2
+ name = "meafs"
3
+ version = "0.0.1"
4
+ authors = [
5
+ { name="Matheus J. Castro" }
6
+ ]
7
+ description="Multiple Element Abundance Fit Software"
8
+ readme = "README.md"
9
+ requires-python = ">=3.7"
10
+ classifiers=[
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ ]
15
+ license = {file = "LICENSE"}
16
+ dependencies = [
17
+ "astropy",
18
+ "specutils",
19
+ "scipy",
20
+ "matplotlib",
21
+ "pandas",
22
+ "numpy",
23
+ "desktop_file",
24
+ "pathlib",
25
+ "PyQt6",
26
+ "dill"
27
+ ]
28
+
29
+ [project.scripts]
30
+ meafs = "meafs_code.gui:main"
31
+ meafs-desktop-create = "meafs_code.desktop_entry:create"
32
+ meafs-desktop-remove = "meafs_code.desktop_entry:remove"
33
+
34
+ [project.urls]
35
+ "Homepage" = "https://github.com/MatheusJCastro/meafs"
36
+
meafs-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+