itcpr 1.0.2__tar.gz → 1.0.4__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.
itcpr-1.0.4/PKG-INFO ADDED
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.1
2
+ Name: itcpr
3
+ Version: 1.0.4
4
+ Summary: Your tools for ITCPR
5
+ Home-page: https://github.com/abdussamiakanda/itcpr-tools
6
+ Author: Md. Abdus Sami Akanda
7
+ Author-email: abdussamiakanda@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # ITCPR Tools Library
16
+
17
+ This Python library provides utilities for your internship at ITCPR, including features for plotting data, generating mumax3 commands based on file naming patterns, and renaming files for organizational purposes.
18
+
19
+ ## Installation
20
+
21
+ To install the GRE Tool Library, run the following command:
22
+
23
+ ```pip install itcpr```
24
+
25
+
26
+ ## Features
27
+
28
+ - **Data Plotting**: Easily plot specific parameters from data files for analysis.
29
+ - **MuMaX3 Command Generation**: Automate the generation of mumax3 commands for simulations.
30
+ - **File Renaming**: Streamline your file organization by renaming `table.txt` files according to their parent directory names.
31
+
32
+ ## Usage
33
+
34
+ #### Plotting Data `plot(file_path, parameter_names)`
35
+
36
+ Plots specified parameters from a given file.
37
+
38
+ Args:
39
+ - `file_path`: Path to the data file.
40
+ - `parameter_names`: List of parameter names to plot.
41
+
42
+ Plot specified parameters from a data file to visualize your GRE preparation data:
43
+
44
+ ```python
45
+ import spintronics as spin
46
+
47
+ file_path = "path/to/your/data/filename.txt"
48
+ parameter_names = ["Parameter1", "Parameter2"] #use one or more parameters
49
+ spin.plot(file_path, parameter_names)
50
+ ```
51
+
52
+ Look into your `table.txt` file to know what parameters you have there. For example:
53
+ - `mx ()`
54
+ - `my ()`
55
+ - `mz ()`
56
+ - and more...
57
+
58
+ #### Generating mumax3 Commands `m3_commands(base_folder, filename_pattern, ranges)`
59
+
60
+ Prints mumax3 commands for files based on a pattern with multiple 'cng' placeholders, each having different start, end values, and increments, and then prints 'mumax3' at the end.
61
+
62
+ Args:
63
+ - base_folder: The base folder address where the files are located or will be saved.
64
+ - filename_pattern: The pattern of the filename with 'cng' as placeholders.
65
+ - ranges: A list of tuples, each tuple contains (start_value, end_value, increment) for each 'cng'.
66
+
67
+ Generate mumax3 commands for a series of files, facilitating batch run of simulations:
68
+
69
+ ```python
70
+ from spintronics as spin
71
+
72
+ base_folder = "path/to/base/folder"
73
+ filename_pattern = "N_2_2_2_C_1_1_1_A_cng_f_cng.m3"
74
+ ranges = [(10, 15, 1), (18.5, 21.2, 0.1)] # Example for two placeholders with their ranges
75
+ spin.m3_commands(base_folder, filename_pattern, ranges)
76
+ ```
77
+
78
+ #### Renaming Table Files `rename_tables(base_dir)`
79
+
80
+ Renames all 'table.txt' files to match their parent folder names (without the '.out' extension) with '.txt' extension, within folders ending with '.out' found anywhere under the specified base directory.
81
+
82
+ Args:
83
+ - base_dir: The base directory to recursively search for '.out' folders.
84
+
85
+ Automatically rename table.txt files within .out folders to match their parent folder's name, improving file organization:
86
+
87
+ ```python
88
+ from spintronics as spin
89
+
90
+ base_dir = "path/to/your/base/directory" # make sure to use / instead of \ in the path
91
+ spin.rename_tables(base_dir)
92
+ ```
93
+
94
+ ## Contribute
95
+ If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
96
+
97
+ ## License
98
+ © 2021 Md. Abdus Sami Akanda
99
+
100
+ This repository is licensed under the MIT license. See LICENSE for details.
itcpr-1.0.4/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # ITCPR Tools Library
2
+
3
+ This Python library provides utilities for your internship at ITCPR, including features for plotting data, generating mumax3 commands based on file naming patterns, and renaming files for organizational purposes.
4
+
5
+ ## Installation
6
+
7
+ To install the GRE Tool Library, run the following command:
8
+
9
+ ```pip install itcpr```
10
+
11
+
12
+ ## Features
13
+
14
+ - **Data Plotting**: Easily plot specific parameters from data files for analysis.
15
+ - **MuMaX3 Command Generation**: Automate the generation of mumax3 commands for simulations.
16
+ - **File Renaming**: Streamline your file organization by renaming `table.txt` files according to their parent directory names.
17
+
18
+ ## Usage
19
+
20
+ #### Plotting Data `plot(file_path, parameter_names)`
21
+
22
+ Plots specified parameters from a given file.
23
+
24
+ Args:
25
+ - `file_path`: Path to the data file.
26
+ - `parameter_names`: List of parameter names to plot.
27
+
28
+ Plot specified parameters from a data file to visualize your GRE preparation data:
29
+
30
+ ```python
31
+ import spintronics as spin
32
+
33
+ file_path = "path/to/your/data/filename.txt"
34
+ parameter_names = ["Parameter1", "Parameter2"] #use one or more parameters
35
+ spin.plot(file_path, parameter_names)
36
+ ```
37
+
38
+ Look into your `table.txt` file to know what parameters you have there. For example:
39
+ - `mx ()`
40
+ - `my ()`
41
+ - `mz ()`
42
+ - and more...
43
+
44
+ #### Generating mumax3 Commands `m3_commands(base_folder, filename_pattern, ranges)`
45
+
46
+ Prints mumax3 commands for files based on a pattern with multiple 'cng' placeholders, each having different start, end values, and increments, and then prints 'mumax3' at the end.
47
+
48
+ Args:
49
+ - base_folder: The base folder address where the files are located or will be saved.
50
+ - filename_pattern: The pattern of the filename with 'cng' as placeholders.
51
+ - ranges: A list of tuples, each tuple contains (start_value, end_value, increment) for each 'cng'.
52
+
53
+ Generate mumax3 commands for a series of files, facilitating batch run of simulations:
54
+
55
+ ```python
56
+ from spintronics as spin
57
+
58
+ base_folder = "path/to/base/folder"
59
+ filename_pattern = "N_2_2_2_C_1_1_1_A_cng_f_cng.m3"
60
+ ranges = [(10, 15, 1), (18.5, 21.2, 0.1)] # Example for two placeholders with their ranges
61
+ spin.m3_commands(base_folder, filename_pattern, ranges)
62
+ ```
63
+
64
+ #### Renaming Table Files `rename_tables(base_dir)`
65
+
66
+ Renames all 'table.txt' files to match their parent folder names (without the '.out' extension) with '.txt' extension, within folders ending with '.out' found anywhere under the specified base directory.
67
+
68
+ Args:
69
+ - base_dir: The base directory to recursively search for '.out' folders.
70
+
71
+ Automatically rename table.txt files within .out folders to match their parent folder's name, improving file organization:
72
+
73
+ ```python
74
+ from spintronics as spin
75
+
76
+ base_dir = "path/to/your/base/directory" # make sure to use / instead of \ in the path
77
+ spin.rename_tables(base_dir)
78
+ ```
79
+
80
+ ## Contribute
81
+ If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
82
+
83
+ ## License
84
+ © 2021 Md. Abdus Sami Akanda
85
+
86
+ This repository is licensed under the MIT license. See LICENSE for details.
@@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
7
7
 
8
8
  setup(
9
9
  name="itcpr",
10
- version="1.0.2",
10
+ version="1.0.4",
11
11
  description="Your tools for ITCPR",
12
12
  long_description=README,
13
13
  long_description_content_type="text/markdown",
@@ -19,7 +19,7 @@ setup(
19
19
  'License :: OSI Approved :: MIT License',
20
20
  'Operating System :: OS Independent',
21
21
  ],
22
- py_modules=["tools"],
22
+ py_modules=["spintronics"],
23
23
  package_dir={'': 'src'},
24
24
  install_requires=[],
25
25
  )
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.1
2
+ Name: itcpr
3
+ Version: 1.0.4
4
+ Summary: Your tools for ITCPR
5
+ Home-page: https://github.com/abdussamiakanda/itcpr-tools
6
+ Author: Md. Abdus Sami Akanda
7
+ Author-email: abdussamiakanda@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # ITCPR Tools Library
16
+
17
+ This Python library provides utilities for your internship at ITCPR, including features for plotting data, generating mumax3 commands based on file naming patterns, and renaming files for organizational purposes.
18
+
19
+ ## Installation
20
+
21
+ To install the GRE Tool Library, run the following command:
22
+
23
+ ```pip install itcpr```
24
+
25
+
26
+ ## Features
27
+
28
+ - **Data Plotting**: Easily plot specific parameters from data files for analysis.
29
+ - **MuMaX3 Command Generation**: Automate the generation of mumax3 commands for simulations.
30
+ - **File Renaming**: Streamline your file organization by renaming `table.txt` files according to their parent directory names.
31
+
32
+ ## Usage
33
+
34
+ #### Plotting Data `plot(file_path, parameter_names)`
35
+
36
+ Plots specified parameters from a given file.
37
+
38
+ Args:
39
+ - `file_path`: Path to the data file.
40
+ - `parameter_names`: List of parameter names to plot.
41
+
42
+ Plot specified parameters from a data file to visualize your GRE preparation data:
43
+
44
+ ```python
45
+ import spintronics as spin
46
+
47
+ file_path = "path/to/your/data/filename.txt"
48
+ parameter_names = ["Parameter1", "Parameter2"] #use one or more parameters
49
+ spin.plot(file_path, parameter_names)
50
+ ```
51
+
52
+ Look into your `table.txt` file to know what parameters you have there. For example:
53
+ - `mx ()`
54
+ - `my ()`
55
+ - `mz ()`
56
+ - and more...
57
+
58
+ #### Generating mumax3 Commands `m3_commands(base_folder, filename_pattern, ranges)`
59
+
60
+ Prints mumax3 commands for files based on a pattern with multiple 'cng' placeholders, each having different start, end values, and increments, and then prints 'mumax3' at the end.
61
+
62
+ Args:
63
+ - base_folder: The base folder address where the files are located or will be saved.
64
+ - filename_pattern: The pattern of the filename with 'cng' as placeholders.
65
+ - ranges: A list of tuples, each tuple contains (start_value, end_value, increment) for each 'cng'.
66
+
67
+ Generate mumax3 commands for a series of files, facilitating batch run of simulations:
68
+
69
+ ```python
70
+ from spintronics as spin
71
+
72
+ base_folder = "path/to/base/folder"
73
+ filename_pattern = "N_2_2_2_C_1_1_1_A_cng_f_cng.m3"
74
+ ranges = [(10, 15, 1), (18.5, 21.2, 0.1)] # Example for two placeholders with their ranges
75
+ spin.m3_commands(base_folder, filename_pattern, ranges)
76
+ ```
77
+
78
+ #### Renaming Table Files `rename_tables(base_dir)`
79
+
80
+ Renames all 'table.txt' files to match their parent folder names (without the '.out' extension) with '.txt' extension, within folders ending with '.out' found anywhere under the specified base directory.
81
+
82
+ Args:
83
+ - base_dir: The base directory to recursively search for '.out' folders.
84
+
85
+ Automatically rename table.txt files within .out folders to match their parent folder's name, improving file organization:
86
+
87
+ ```python
88
+ from spintronics as spin
89
+
90
+ base_dir = "path/to/your/base/directory" # make sure to use / instead of \ in the path
91
+ spin.rename_tables(base_dir)
92
+ ```
93
+
94
+ ## Contribute
95
+ If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
96
+
97
+ ## License
98
+ © 2021 Md. Abdus Sami Akanda
99
+
100
+ This repository is licensed under the MIT license. See LICENSE for details.
@@ -2,6 +2,7 @@ LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
4
  setup.py
5
+ src/spintronics.py
5
6
  src/itcpr.egg-info/PKG-INFO
6
7
  src/itcpr.egg-info/SOURCES.txt
7
8
  src/itcpr.egg-info/dependency_links.txt
@@ -0,0 +1 @@
1
+ spintronics
@@ -0,0 +1,143 @@
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+ import itertools
4
+ import os
5
+ import glob
6
+
7
+
8
+ def start():
9
+ f = open("progress.txt","a")
10
+ f.writelines(["# Data:False\n"])
11
+ f.close()
12
+
13
+ url = 'https://drive.google.com/uc?export=download&id=1kLBuhoDUUvrJOuBOLUGff0JYr8dB_nQJ'
14
+ r = requests.get(url, allow_redirects=True)
15
+ open('vocabulary.txt', 'wb').write(r.content)
16
+
17
+ print("Welcome to your python GRE preparation tool. Necessary files are created.")
18
+ print("To learn more about GRE use 'gre.about()', and to learn more about this library use 'gre.help()'.")
19
+
20
+
21
+ def plot(file_path, parameter_names):
22
+ """
23
+ Plots specified parameters from a given file.
24
+
25
+ Args:
26
+ - file_path: Path to the data file.
27
+ - parameter_names: List of parameter names to plot.
28
+ """
29
+ data = []
30
+ axis_names = []
31
+ selected_columns = []
32
+
33
+ # Open the file and read data
34
+ with open(file_path, "r") as file:
35
+ for line in file:
36
+ if line.startswith("#"):
37
+ # Extracting axis names
38
+ axis_names = line.strip().split('\t')
39
+ # Determine which columns to plot based on parameter_names
40
+ selected_columns = [axis_names.index(name) for name in parameter_names if name in axis_names]
41
+ else:
42
+ values = [float(value) for value in line.split("\t")]
43
+ data.append(values)
44
+
45
+ if not selected_columns: # Check if selected_columns is empty
46
+ print("None of the specified parameters were found in the file.")
47
+ return
48
+
49
+ # Convert the list of lists into a NumPy array for easier slicing
50
+ data = np.array(data)
51
+
52
+ # Adjust the number of subplots based on selected parameters
53
+ num_parameters = len(selected_columns)
54
+
55
+ # Creating subplots
56
+ fig, axs = plt.subplots(num_parameters, 1, figsize=(10, num_parameters * 3), squeeze=False)
57
+
58
+ # Loop over each selected parameter to create a subplot
59
+ for i, column_index in enumerate(selected_columns):
60
+ axs[i, 0].plot(data[:, 0], data[:, column_index], label=f"${axis_names[column_index]}$")
61
+ axs[i, 0].set_xlabel(axis_names[0])
62
+ axs[i, 0].set_ylabel(axis_names[column_index])
63
+ axs[i, 0].legend()
64
+
65
+ # Adjust layout to prevent overlapping
66
+ plt.tight_layout()
67
+ plt.show()
68
+
69
+
70
+
71
+ def m3_commands(base_folder, filename_pattern, ranges):
72
+ """
73
+ Prints mumax3 commands for files based on a pattern with multiple 'cng' placeholders,
74
+ each having different start, end values, and increments, and then prints 'mumax3' at the end.
75
+
76
+ Args:
77
+ - base_folder: The base folder address where the files are located or will be saved.
78
+ - filename_pattern: The pattern of the filename with 'cng' as placeholders.
79
+ - ranges: A list of tuples, each tuple contains (start_value, end_value, increment) for each 'cng'.
80
+ """
81
+ # Generate all combinations of replacements for 'cng'
82
+ replacement_lists = [list(range(start, end + 1, increment)) for start, end, increment in ranges]
83
+ all_combinations = list(itertools.product(*replacement_lists))
84
+
85
+ for combination in all_combinations:
86
+ # Start with the initial pattern for each combination
87
+ filename = filename_pattern
88
+
89
+ # Replace each 'cng' with the corresponding value from the combination
90
+ for value in combination:
91
+ filename = filename.replace('cng', str(value), 1) # Replace the first occurrence
92
+
93
+ full_command = f"mumax3 {base_folder}/{filename}"
94
+ print(full_command)
95
+
96
+ # Print the final 'mumax3' command
97
+ print('mumax3')
98
+
99
+
100
+ def rename_tables(base_dir):
101
+ """
102
+ Renames all 'table.txt' files to match their parent folder names (without the '.out' extension) with '.txt' extension,
103
+ within folders ending with '.out' found anywhere under the specified base directory.
104
+ Automatically converts backslashes in the base directory path to forward slashes to avoid Unicode errors.
105
+
106
+ Args:
107
+ - base_dir: The base directory to recursively search for '.out' folders.
108
+ """
109
+ # Automatically convert backslashes to forward slashes to avoid Unicode errors
110
+ base_dir = base_dir.replace("\\", "/")
111
+
112
+ # Pattern to match all '.out' folders within the base directory, recursively
113
+ out_folders_pattern = os.path.join(base_dir, "**", "*.out")
114
+
115
+ # Find all folders matching the pattern, recursively
116
+ out_folders = glob.glob(out_folders_pattern, recursive=True)
117
+
118
+ for folder in out_folders:
119
+ old_file_path = os.path.join(folder, "table.txt")
120
+ if os.path.exists(old_file_path): # Check if 'table.txt' exists in the folder
121
+ # Extract the folder name without the path and remove '.out' extension
122
+ base_name = os.path.basename(folder).replace(".out", "")
123
+ new_file_name = f"{base_name}.txt"
124
+ new_file_path = os.path.join(folder, new_file_name)
125
+
126
+ # Rename the file
127
+ os.rename(old_file_path, new_file_path)
128
+ print(f"Renamed '{old_file_path}' to '{new_file_path}'")
129
+
130
+
131
+ def help():
132
+ print("start() : builds necessary database for the package")
133
+ print("hello() : gets you started with the package")
134
+ print("about() : GRE basic informations")
135
+ print("new() : adds new word of GRE vocabulary")
136
+ print("meaning() : prints out the meaning of a given word")
137
+ print("set() : prints out all the words in a set")
138
+ print("flash() : flashcard of a set")
139
+ print("exam() : takes a random vocabulary quiz")
140
+ print("progress() : shows data about your preparation progress")
141
+ print("update() : updates database from the internet")
142
+
143
+
itcpr-1.0.2/PKG-INFO DELETED
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: itcpr
3
- Version: 1.0.2
4
- Summary: Your tools for ITCPR
5
- Home-page: https://github.com/abdussamiakanda/itcpr-tools
6
- Author: Md. Abdus Sami Akanda
7
- Author-email: abdussamiakanda@gmail.com
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
-
15
- # GRE for Noobs
16
- ITCPR is a python library that helps you with your GRE preparation. It has features such as adding new words in your vocabulary database, trying random vocabulary quizzes, etc.
17
-
18
- ## Installation
19
- ```pip install itcpr```
20
-
21
- ## How to use it?
22
- - Import the library `import gre`
23
- - Start building necessary database `gre.start()`
24
- - Start recording your progress `gre.hello()`
25
- - GRE basic informations `gre.about()`
26
- - Add new words in your vocabulary file `gre.new()`
27
- - Find meaning of a word `gre.meaning()`
28
- - View all words in a set `gre.set()`
29
- - Flashcard of a set `gre.flash()`
30
- - Try a random vocabulary quiz `gre.exam()`
31
- - See your progress `gre.progress()`
32
- - Updates database from the internet `gre.update()`
33
- - Ask for help `gre.help()`
34
-
35
- ## Contribute
36
- If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
37
-
38
- ## License
39
- © 2021 Md. Abdus Sami Akanda
40
-
41
- This repository is licensed under the MIT license. See LICENSE for details.
itcpr-1.0.2/README.md DELETED
@@ -1,27 +0,0 @@
1
- # GRE for Noobs
2
- ITCPR is a python library that helps you with your GRE preparation. It has features such as adding new words in your vocabulary database, trying random vocabulary quizzes, etc.
3
-
4
- ## Installation
5
- ```pip install itcpr```
6
-
7
- ## How to use it?
8
- - Import the library `import gre`
9
- - Start building necessary database `gre.start()`
10
- - Start recording your progress `gre.hello()`
11
- - GRE basic informations `gre.about()`
12
- - Add new words in your vocabulary file `gre.new()`
13
- - Find meaning of a word `gre.meaning()`
14
- - View all words in a set `gre.set()`
15
- - Flashcard of a set `gre.flash()`
16
- - Try a random vocabulary quiz `gre.exam()`
17
- - See your progress `gre.progress()`
18
- - Updates database from the internet `gre.update()`
19
- - Ask for help `gre.help()`
20
-
21
- ## Contribute
22
- If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
23
-
24
- ## License
25
- © 2021 Md. Abdus Sami Akanda
26
-
27
- This repository is licensed under the MIT license. See LICENSE for details.
@@ -1,41 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: itcpr
3
- Version: 1.0.2
4
- Summary: Your tools for ITCPR
5
- Home-page: https://github.com/abdussamiakanda/itcpr-tools
6
- Author: Md. Abdus Sami Akanda
7
- Author-email: abdussamiakanda@gmail.com
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
-
15
- # GRE for Noobs
16
- ITCPR is a python library that helps you with your GRE preparation. It has features such as adding new words in your vocabulary database, trying random vocabulary quizzes, etc.
17
-
18
- ## Installation
19
- ```pip install itcpr```
20
-
21
- ## How to use it?
22
- - Import the library `import gre`
23
- - Start building necessary database `gre.start()`
24
- - Start recording your progress `gre.hello()`
25
- - GRE basic informations `gre.about()`
26
- - Add new words in your vocabulary file `gre.new()`
27
- - Find meaning of a word `gre.meaning()`
28
- - View all words in a set `gre.set()`
29
- - Flashcard of a set `gre.flash()`
30
- - Try a random vocabulary quiz `gre.exam()`
31
- - See your progress `gre.progress()`
32
- - Updates database from the internet `gre.update()`
33
- - Ask for help `gre.help()`
34
-
35
- ## Contribute
36
- If you have discovered a bug or something else you want to change, feel free to contact the author at `abdussamiakanda@gmail.com`.
37
-
38
- ## License
39
- © 2021 Md. Abdus Sami Akanda
40
-
41
- This repository is licensed under the MIT license. See LICENSE for details.
@@ -1 +0,0 @@
1
- tools
File without changes
File without changes
File without changes