diff --git a/README.md b/README.md index 5fc97bd..a3995c8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Customizable output in RGB, Hex, image or spectra database table. ## Installation **Basic installation way** + Tested on Windows 10/11 and Linux (openSUSE). 1. Clone the repository or download archive by the GitHub web interface (press the button `Code`, then I recommend choosing `Download ZIP`, unpack the archive after downloading); @@ -17,6 +18,7 @@ Tested on Windows 10/11 and Linux (openSUSE). 3. Run [TCT.py](Scripts/TCT.py) **Executable file (no Python)** + Only for Windows. Please note that this installation way is [SevenSpheres](https://github.com/SevenSpheres)' initiative and the relevance of updates is not guaranteed. 1. Go to [releases of SevenSpheres' fork](https://github.com/SevenSpheres/TrueColorTools/releases); @@ -26,7 +28,7 @@ Only for Windows. Please note that this installation way is [SevenSpheres](https ## How to use -[TCT.py](Scripts/TCT.py) includes three tabs for different purposes: *Spectra*, *Images* and *Table*. The first and last tabs are linked to the database, the *Images* tab asks for input. No internet connection is required. +[`TCT.py`](Scripts/TCT.py) includes three tabs for different purposes: *Spectra*, *Images* and *Table*. The first and last tabs are linked to the database, the *Images* tab asks for input. No internet connection is required. Several global concepts: - The wavelengths are always increasing. This is important for customizing the database and for numbering images. @@ -34,12 +36,13 @@ Several global concepts: - Tag system. Each object in the database can be assigned an arbitrary set of tags. Same tags form a lists in the *Spectra* and *Table* tabs, which simplify interaction with a huge database. - System of sources. Each object in the database can be easily linked to one or several sources by its number. You can see the list in `File`→`Sources`. Also, after an object's name there can be abbreviations, the decoding of which is indicated in `File`→`Notes`. -**Spectra tab** provides access to the built-in spectra database and allows you to calculate a color with the selected settings just by clicking on an object. +**Spectra tab** provides access to the built-in spectra database and allows to calculate a color with the selected settings just by clicking on an object. + For example, you can get colors formatted for [Celestia](https://github.com/CelestiaProject/Celestia), which uses chromaticity values from 0 to 1 for each color channel, where 1 is the value of the brightest channel. Make sure that the `chromaticity` mode is used and `Decimal places` is greater than zero (by default it is), and then set the `Color (bit) depth` parameter to zero. -**Images tab** allows you to load images, specify their wavelength and display a true color image, for each pixel of which a spectrum was built. +**Images tab** allows you to load image(s), specify wavelengths and save a processed image, for each pixel of which a spectrum was built. It takes a very long time with the current algorithm, so you can check out the preview. -**Table tab** generates a customizable table of calculated colors from the spectra database. +**Table tab** generates a customizable table of calculated colors from the spectra database. You can see examples [here](Tables/). ### Auxiliary @@ -48,18 +51,19 @@ For example, you can get colors formatted for [Celestia](https://github.com/Cele - [`calculations.py`](Scripts/calculations.py) is the mathematical core. It contains most of functions and some zero points of photometric systems; - [`cmf.py`](Scripts/cmf.py) contains sensitivity of human perception and used curve of color space; - [`database.py`](Scripts/database.py) contains spectra, color indices and their sources; +- [`filters.py`](Scripts/filters.py) is a database of spacecraft photometric systems; - [`strings.py`](Scripts/strings.py) contains almost all used inscriptions of other scripts in supported languages. ## Database format ### Mandatory parameters -- `nm`: list of wavelengths in nm +- `nm`: list of wavelengths in nanometers - `br`: same-size list of reflectivity - `mag`: same-size list of magnitudes -- `filters`: filter system, one from convert.py → filters +- `filters`: filter system, linked with [`filters.py`](Scripts/filters.py) - `indices`: dictionary of color indices, use only with `filters` -- `bands`: list of filters' names, use only with `filters` and `i/f` instead of `br` +- `bands`: list of filters' names, use only with `filters` ### Optional parameters - `albedo`: bool (`True` if reflectivity was set by albedo values) or float (in V band or on 550 nm) diff --git a/Scripts/TCT.py b/Scripts/TCT.py index 23b6fbf..a1c41ae 100644 --- a/Scripts/TCT.py +++ b/Scripts/TCT.py @@ -254,7 +254,7 @@ def convert_to_bytes(img): window["T3_process"].update(tr.gui_process[lang]) elif event == tr.source[lang]: - sg.popup("\n\n".join(db.sources), title=event, line_width=120, location=(16, 25)) + sg.popup_scrolled("\n\n".join(db.sources), title=event, size=(100, 20)) elif event == tr.note[lang]: notes = [] @@ -263,7 +263,7 @@ def convert_to_bytes(img): sg.popup("\n".join(notes), title=event) elif event == tr.gui_info[lang]: - sg.popup(tr.auth_info[lang], title=event) + sg.popup("https://github.com/Askaniy/TrueColorTools\n"+tr.auth_info[lang], title=event) # ------------ Events in the tab "Spectra" ------------ diff --git a/Scripts/calculations.py b/Scripts/calculations.py index be274eb..946a899 100644 --- a/Scripts/calculations.py +++ b/Scripts/calculations.py @@ -90,19 +90,19 @@ def subtract_sun(spectrum, sun): br.append(corrected) nm.append(sun_nm) spectrum.update({"nm": nm, "br": br, "sun": False}) - spectrum.pop("filters") + return spectrum def transform(spectrum): if "filters" in spectrum: - if "i/r" in spectrum: - spectrum.update({"br": spectrum["i/r"]}) # important for subtract_sun if "bands" in spectrum: spectrum = from_filters(spectrum) # replacement of filters for their wavelengths elif "indices" in spectrum: spectrum = from_indices(spectrum) # spectrum from color indices + spectrum.pop("filters") if "mag" in spectrum: spectrum = from_magnitudes(spectrum, database.objects["Vega|1"]) # spectrum from magnitudes + spectrum.pop("mag") if "sun" in spectrum: if spectrum["sun"]: spectrum = subtract_sun(spectrum, database.objects["Sun|1"]) # subtract solar spectrum diff --git a/Scripts/database.py b/Scripts/database.py index f595db5..6f49c1f 100644 --- a/Scripts/database.py +++ b/Scripts/database.py @@ -563,7 +563,7 @@ "filters": "Landolt", "indices": {"B-V": 0.67, "V-R": 0.38}, "sun": True }, "Nereid|32": {"tags": ["featured", "solar_system", "moon", "neptunian_system", "irregular"], - "filters": "Landolt", "bands": ["U", "B", "V", "R", "I"], "i/r": [0.90, 0.93, 1, 1.13, 0.99], "albedo": 0.24 # https://arxiv.org/abs/1601.02395 + "filters": "Landolt", "bands": ["U", "B", "V", "R", "I"], "br": [0.90, 0.93, 1, 1.13, 0.99], "albedo": 0.24 # https://arxiv.org/abs/1601.02395 }, "Neptunian irregulars|30": {"tags": ["featured", "solar_system", "class", "moon", "neptunian_system", "irregular"], "filters": "Landolt", "indices": {"B-V": 0.77, "V-R": 0.50}, "sun": True @@ -2224,13 +2224,13 @@ # "filters": "Hubble", "indices": {"F606W-F814W": 1.03}, "sun": True #}, "(486958) Ultima|17": {"tags": ["featured", "solar_system", "minor_body", "tno", "classical", "classical-h"], - "filters": "New Horizons", "bands": ["blue", "red", "nir"], "i/r": [0.053, 0.079, 0.117], "sun": True, "albedo": True + "filters": "New Horizons", "bands": ["blue", "red", "nir"], "br": [0.053, 0.079, 0.117], "sun": True, "albedo": True }, "(486958) Thule|17": {"tags": ["featured", "solar_system", "minor_body", "tno", "classical", "classical-h"], - "filters": "New Horizons", "bands": ["blue", "red", "nir"], "i/r": [0.058, 0.084, 0.122], "sun": True, "albedo": True + "filters": "New Horizons", "bands": ["blue", "red", "nir"], "br": [0.058, 0.084, 0.122], "sun": True, "albedo": True }, '(486958) "neck"|17': {"tags": ["featured", "solar_system", "minor_body", "tno", "classical", "classical-h"], - "filters": "New Horizons", "bands": ["blue", "red", "nir"], "i/r": [0.066, 0.090, 0.125], "sun": True, "albedo": True + "filters": "New Horizons", "bands": ["blue", "red", "nir"], "br": [0.066, 0.090, 0.125], "sun": True, "albedo": True }, "(506479) 2003 HB57|9": {"tags": ["solar_system", "minor_body", "tno", "scattered"], "filters": "Landolt", "indices": {"B-V": 0.830, "V-R": 0.480, "R-I": 0.540}, "sun": True @@ -2468,13 +2468,13 @@ "albedo": True }, "HD 189733 b|10, 15": {"tags": ["featured", "extrasolar", "planet"], - "filters": "Landolt", "bands": ["U", "B", "V", "I"], "i/r": [0.62, 0.61, 0.28, 0], "albedo": True + "filters": "Landolt", "bands": ["U", "B", "V", "I"], "br": [0.62, 0.61, 0.28, 0], "albedo": True }, "HD 189733 b|13, 14": {"tags": ["extrasolar", "planet"], "nm": [290, 368, 370, 416, 459, 510, 547, 875], "br": [0.45, 0.39, 0.374, 0.32, 0.17, 0.043, 0.02, 0.025], "albedo": True }, "Ups And b|15": {"tags": ["featured", "extrasolar", "planet"], - "filters": "Landolt", "bands": ["U", "B", "V"], "i/r": [0.53, 0.67, 0.29], "albedo": True + "filters": "Landolt", "bands": ["U", "B", "V"], "br": [0.53, 0.67, 0.29], "albedo": True }, "WASP-18 b": {"tags": ["extrasolar", "planet"], "nm": [440, 788, 900], "br": [0.075, 0.048, 0.05], "albedo": True