GUIBRUSHR.GUI.DataInterface.DBSQLite3 module¶
- class GUIBRUSHR.GUI.DataInterface.DBSQLite3.DBSQLite3(path)[source]¶
Bases:
objectDatabase management class for GUIBRUSHR application.
This class handles all database operations for the application, including: - Creation and management of database tables - Instrument management (insert, delete, query) - Retrieval run management (insert, delete, query)
The database consists of three main tables: 1. retrieval_run: Stores information about retrieval runs 2. instruments: Stores information about available instruments 3. observatories: Stores information about observatory locations
- DB¶
Database connection object
- Type:
sqlite3.Connection
- cursor¶
Database cursor object
- Type:
sqlite3.Cursor
- __init__(path) None[source]¶
Initialize database connection.
- Parameters:
path (Path) – Base path for the application
- create_db() None[source]¶
Create database tables if they don’t exist.
Creates three main tables: 1. retrieval_run: For storing retrieval run information 2. instruments: For storing instrument information 3. observatories: For storing observatory information
- insert_instrument(instrument: str, resolution: str, hwhm_km_s, wl_min, wl_max) None[source]¶
Insert a new instrument into the database.
- Parameters:
instrument (str) – Instrument identifier
resolution (str) – Instrument resolution
hwhm_km_s – Half-width at half maximum in km/s
wl_min – Minimum wavelength in micrometers
wl_max – Maximum wavelength in micrometers
- delete_instrument_by_key(instrument: str) bool[source]¶
Delete an instrument from the database.
- Parameters:
instrument (str) – Instrument identifier to delete
- Returns:
True if deletion was successful, False otherwise
- Return type:
bool
- get_instruments()[source]¶
Get all instruments from the database.
- Returns:
List of instrument identifiers
List of resolutions
List of HWHM values
List of minimum wavelengths
List of maximum wavelengths
- Return type:
Tuple containing
- get_instrument_by_key(instrument: str)[source]¶
Get instrument details by its identifier.
- Parameters:
instrument (str) – Instrument identifier to look up
- Returns:
Instrument object with the retrieved details, or None if not found
- Return type:
- insert_retrieval_into_DB(retrieval_date: str, target: str, nights: str, chemistry: str, t_p_profile: str, scattering: str, ecc_opi: str, order_selection: str, retrieval_model: str, resolution: str, tell_rm_method: str, rad_mode: str, instruments: str, user_id: str, bestpars_params: str, fixed_params: str, molecules: str, sigma_priors: str) bool[source]¶
Insert a new retrieval run into the database.
- Parameters:
retrieval_date (str) – Date of the retrieval run
target (str) – Target identifier
nights (str) – Observation nights
chemistry (str) – Chemistry type
t_p_profile (str) – Temperature-pressure profile
scattering (str) – Scattering flag
ecc_opi (str) – Eccentricity/obliquity flag
order_selection (str) – Order selection method
retrieval_model (str) – Retrieval model used
resolution (str) – Resolution type
tell_rm_method (str) – Telluric removal method
rad_mode (str) – Radiation mode
instruments (str) – Instruments used
user_id (str) – User identifier
bestpars_params (str) – Best parameters
fixed_params (str) – Fixed parameters
molecules (str) – Molecules involved
sigma_priors (str) – Sigma priors
- Returns:
True if insertion was successful, False otherwise
- Return type:
bool
- select_retrieval_by_target(user_idf: str, target: str, chemistry: str = 'None', t_p_profile: str = 'None', scattering: str = 'None', ecc_opi: str = 'None', resolution: str = 'None', retrieval_model: str = 'None', rad_mode: str = 'None', instruments: str = 'None') Tuple[List[Any], ...][source]¶
Select retrieval runs by target with optional filters.
- Parameters:
user_idf (str) – User identifier
target (str) – Target identifier
chemistry (str, optional) – Chemistry filter
t_p_profile (str, optional) – Temperature-pressure profile filter
scattering (str, optional) – Scattering filter
ecc_opi (str, optional) – Eccentricity/obliquity filter
resolution (str, optional) – Resolution filter
retrieval_model (str, optional) – Retrieval model filter
rad_mode (str, optional) – Radiation mode filter
instruments (str, optional) – Instruments filter
- Returns:
Tuple of lists containing retrieval run details
- delete_retrieval_by_date(retrieval_date: str) bool[source]¶
Delete a retrieval run by its date.
- Parameters:
retrieval_date (str) – Date of the retrieval run to delete
- Returns:
True if deletion was successful, False otherwise
- Return type:
bool
- insert_observatory(name: str, latitude: float, longitude: float, altitude: float) None[source]¶
Insert a new observatory into the database.
- Parameters:
name (str) – Observatory name
latitude (float) – Observatory latitude in degrees
longitude (float) – Observatory longitude in degrees
altitude (float) – Observatory altitude in meters
- delete_observatory_by_key(name: str) bool[source]¶
Delete an observatory from the database.
- Parameters:
name (str) – Observatory name to delete
- Returns:
True if deletion was successful, False otherwise
- Return type:
bool
- get_observatories()[source]¶
Get all observatories from the database.
- Returns:
List of observatory names
List of latitudes
List of longitudes
List of altitudes
- Return type:
Tuple containing