Commit c7d8f8d5 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add references for join_types

parent efd06df4
Loading
Loading
Loading
Loading
+38 −28
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ from .._csst import csst

# from csst_dag._csst import csst


# THESE ARE GENERAL PARAMETERS!
PLAN_PARAMS = {
    "dataset": None,
@@ -50,6 +49,44 @@ PROC_PARAMS = {
    # should be capable to extend
}

# plan basis keys
PLAN_BASIS_KEYS = (
    "dataset",
    "instrument",
    "obs_type",
    "obs_group",
    "obs_id",
    "n_frame",
    "_id",
)

# data basis keys
DATA_BASIS_KEYS = (
    "dataset",
    "instrument",
    "obs_type",
    "obs_group",
    "obs_id",
    "detector",
    "file_name",
    "_id",
)

# join_type for data x plan
PLAN_JOIN_TYPE = "inner"
"""
References:
    - https://docs.astropy.org/en/stable/api/astropy.table.join.html
    - https://docs.astropy.org/en/stable/table/operations.html#join

Typical types:
    - inner join: Only matching rows from both tables
    - left join: All rows from left table, matching rows from right table
    - right join: All rows from right table, matching rows from left table
    - outer join: All rows from both tables
    - cartesian join: Every combination of rows from both tables
"""


def override_common_keys(d1: dict, d2: dict) -> dict:
    """
@@ -105,33 +142,6 @@ def split_data_basis(data_basis: table.Table, n_split: int = 1) -> list[table.Ta
    return chunks


# plan basis keys
PLAN_BASIS_KEYS = (
    "dataset",
    "instrument",
    "obs_type",
    "obs_group",
    "obs_id",
    "n_frame",
    "_id",
)

# data basis keys
DATA_BASIS_KEYS = (
    "dataset",
    "instrument",
    "obs_type",
    "obs_group",
    "obs_id",
    "detector",
    "file_name",
    "_id",
)

# join_type for data x plan
PLAN_JOIN_TYPE = "inner"


class Dispatcher:
    """
    A class to dispatch tasks based on the observation type.