-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more functionality for rimscode website creation (#10)
* bump version, add config reading to init * add table creator for config parser * Add way to overwrite darkmode of config
- Loading branch information
1 parent
b110444
commit 9417e2a
Showing
6 changed files
with
232 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "rimsschemedrawer" | ||
version = "3.0.0.dev2" | ||
version = "3.0.0.dev3" | ||
description = "Drawing of RIMS schemes in python and/or with a Python GUI." | ||
authors = [ | ||
{ name = "Reto Trappitsch", email = "[email protected]" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Init package | ||
|
||
from .plotter import Plotter | ||
from rimsschemedrawer.json_parser import json_reader, ConfigParser | ||
from rimsschemedrawer.plotter import Plotter | ||
|
||
__all__ = ["Plotter"] | ||
__all__ = ["ConfigParser", "json_reader", "Plotter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Tests for ConfigParser scheme table creation. | ||
|
||
import rimsschemedrawer.json_parser as jp | ||
from rimsschemedrawer.utils import term_to_string as tts | ||
|
||
|
||
def test_ti_new_json(data_path): | ||
"""Return the correct table for the new Ti scheme.""" | ||
json_file = data_path.joinpath("ti_new.json") | ||
data = jp.json_reader(json_file) | ||
|
||
parser = jp.ConfigParser(data) | ||
|
||
header_exp = [ | ||
"Step", | ||
"λ (nm)", | ||
"From (cm⁻¹)", | ||
"To (cm⁻¹)", | ||
] | ||
|
||
table_exp = [ | ||
["1", "465.777", f"0 ({tts('3F2')})", f"21469.500 ({tts('3G3')})"], | ||
["1", "469.498", f"170.150 ({tts('3F3')})", f"21469.500 ({tts('3G3')})"], | ||
["1", "474.324", f"386.880 ({tts('3F4')})", f"21469.500 ({tts('3G3')})"], | ||
["2", "416.158", f"21469.500 ({tts('3G3')})", f"45498.850 ({tts('3G4')})"], | ||
["3", "881.399", f"45498.850 ({tts('3G4')})", "56844.450"], | ||
] | ||
|
||
header, table = parser.scheme_table() | ||
|
||
assert header == header_exp | ||
assert table == table_exp | ||
|
||
|
||
def test_raised_ground(data_path): | ||
"""Return the correct table for a scheme with a raised ground level.""" | ||
json_file = data_path.joinpath("raised_ground_cm.json") | ||
data = jp.json_reader(json_file) | ||
|
||
parser = jp.ConfigParser(data) | ||
|
||
header_exp = [ | ||
"Step", | ||
"λ (nm)", | ||
"From (cm⁻¹)", | ||
"To (cm⁻¹)", | ||
"Forbidden", | ||
"Strength (s⁻¹)", | ||
] | ||
|
||
table_exp = [ | ||
[ | ||
"1", | ||
"400.262", | ||
f"1000.000 ({tts('5D0')})", | ||
f"25983.609 ({tts('5F1')})", | ||
"", | ||
"$1.0 \\times 10^{6}$", | ||
], | ||
[ | ||
"2", | ||
"407.469", | ||
f"25983.609 ({tts('5F1')})", | ||
f"50525.354 ({tts('5D2')})", | ||
"x", | ||
"", | ||
], | ||
[ | ||
"3", | ||
"771.908", | ||
f"50525.354 ({tts('5D2')})", | ||
f"63480.266 ({tts('AI')})", | ||
"", | ||
"$3.0 \\times 10^{5}$", | ||
], | ||
] | ||
|
||
header, table = parser.scheme_table() | ||
|
||
assert header == header_exp | ||
assert table == table_exp |