### Quickstart Kinliuren Chart Calculation Source: https://github.com/kentang2017/kinliuren/blob/master/README.md Import the kinliuren library and create a chart object using solar terms, lunar month, and day/hour stems and branches. The .result(0) method is used to get the chart data. ```python from kinliuren import kinliuren # 格式: Liuren(節氣, 農曆月份, 日干支, 時干支).result(0) ``` -------------------------------- ### Install Kinliuren and Streamlit Dependencies Source: https://context7.com/kentang2017/kinliuren/llms.txt This command installs the necessary Python packages for the Kinliuren library and Streamlit, including `kinliuren`, `streamlit`, `sxtwl`, `pendulum`, `kinqimen`, and `ephem`. ```bash pip install kinliuren streamlit sxtwl pendulum kinqimen ephem ``` -------------------------------- ### Get Noble Person Order (guiren_order_list) Source: https://context7.com/kentang2017/kinliuren/llms.txt Calculates the sequential arrangement of the twelve heavenly generals, determining the starting point of the noble person and the direction of layout based on the day stem and whether it is daytime or nighttime. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("小雪", "十", "丁酉", "壬子") # Get heavenly general layout (0=daytime noble person method) guiren_list = lr.guiren_order_list(0) print("十二天將佈列:") zhi_list = list("子丑寅卯辰巳午未申酉戌亥") for zhi in zhi_list: jiang = guiren_list.get(zhi) print(f"{zhi} -> {jiang}") # Twelve heavenly generals: 貴(天乙貴人), 蛇(騰蛇), 雀(朱雀), 合(六合), # 勾(勾陳), 龍(青龍), 空(天空), 虎(白虎), # 常(太常), 玄(玄武), 陰(太陰), 后(天后) ``` -------------------------------- ### Install Kinliuren Python Package Source: https://github.com/kentang2017/kinliuren/blob/master/README.md Install the Kinliuren library using pip. Requires Python 3.7 or higher. ```bash pip install kinliuren ``` -------------------------------- ### Run Kinliuren Streamlit Web App Locally Source: https://context7.com/kentang2017/kinliuren/llms.txt This command starts the Streamlit web application for the Kinliuren project, allowing you to use its features locally. ```bash streamlit run app.py ``` -------------------------------- ### Get Heaven-Earth盤 (pan) Mapping (sky_n_earth_list) Source: https://context7.com/kentang2017/kinliuren/llms.txt Returns a dictionary mapping earth盤 (pan) branches to heaven盤 (pan) branches, which is fundamental information for Liuren盤局 (panju). It also retrieves the moon general. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("秋分", "八", "壬申", "庚戌") # Get heaven-earth盤 (pan) correspondence sky_earth = lr.sky_n_earth_list() print("地盤 -> 天盤 對應表:") for earth, sky in sky_earth.items(): print(f"地支 {earth} 上臨天盤 {sky}") # Moon general and hour branch determine the starting position of the heaven盤 (pan) moon_general = lr.moongeneral() print(f"\n月將: {moon_general}") ``` -------------------------------- ### guiren_order_list() Method - Noble Person Order Source: https://context7.com/kentang2017/kinliuren/llms.txt The `guiren_order_list()` method calculates the sequential arrangement of the twelve celestial generals. It determines the starting point of the noble person and the direction of arrangement based on the day stem and whether it is day or night. ```APIDOC ## guiren_order_list() Method - Noble Person Order ### Description The `guiren_order_list()` method calculates the sequential arrangement of the twelve celestial generals. It determines the starting point of the noble person and the direction of arrangement based on the day stem and whether it is day or night. ### Method `liuren.guiren_order_list(noble_person_method)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **noble_person_method** (integer) - Required - Specifies the method for calculating the noble person. Typically `0` for day noble person and `1` for night noble person. ### Request Example ```python from kinliuren import kinliuren lr = kinliuren.Liuren("小雪", "十", "丁酉", "壬子") # Get the celestial general arrangement (0=day noble person method) guiren_list = lr.guiren_order_list(0) print("十二天將佈列:") zhi_list = list("子丑寅卯辰巳午未申酉戌亥") for zhi in zhi_list: jiang = guiren_list.get(zhi) print(f"{zhi} -> {jiang}") # Twelve celestial generals: 貴(天乙貴人), 蛇(騰蛇), 雀(朱雀), 合(六合), # 勾(勾陳), 龍(青龍), 空(天空), 虎(白虎), # 常(太常), 玄(玄武), 陰(太陰), 后(天后) ``` ### Response #### Success Response (200) - **guiren_list** (dict) - A dictionary mapping earthly branches to celestial generals. #### Response Example ```json { "子": "貴", "丑": "蛇", "寅": "雀", "卯": "合", "辰": "勾", "巳": "龍", "午": "空", "未": "虎", "申": "常", "酉": "玄", "戌": "陰", "亥": "后" } ``` ``` -------------------------------- ### Initialize Liuren Class and Get Full Result Source: https://context7.com/kentang2017/kinliuren/llms.txt Initializes the `Liuren` class with solar term, lunar month, day stem-branch, and hour stem-branch to generate a complete Da Liuren盤局 (panju). The `result` method with parameter 0 calculates the盤局 (panju) using the daytime noble person method. ```python from kinliuren import kinliuren # Initialize Liuren class # Parameters: solar term, lunar month, day stem-branch, hour stem-branch liuren = kinliuren.Liuren("驚蟄", "二", "己未", "甲午") # Get the full盤局 (panju) result (parameter 0 for daytime noble person method) result = liuren.result(0) print(result) # Example output: # { # '節氣': '驚蟄', # '日期': '己未日甲午時', # '格局': ['賊尅', '重審'], # '日馬': '巳', # '三傳': { # '初傳': ['巳', '虎', '父', '丁'], # '中傳': ['戌', '雀', '兄', '壬'], # '末傳': ['卯', '玄', '官', '乙'] # }, # '四課': { # '四課': ['巳子', '虎'], # '三課': ['子未', '貴'], # '二課': ['巳子', '虎'], # '一課': ['子己', '貴'] # }, # '天地盤': { # '天盤': ['亥', '子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌'], # '地盤': ['午', '未', '申', '酉', '戌', '亥', '子', '丑', '寅', '卯', '辰', '巳'], # '天將': ['蛇', '貴', '后', '陰', '玄', '常', '虎', '空', '龍', '勾', '合', '雀'] # }, # '地轉天盤': {'午': '亥', '未': '子', ...}, # '地轉天將': {'午': '蛇', '未': '貴', ...} # } ``` -------------------------------- ### Get Day-Based Result (result_d) Source: https://context7.com/kentang2017/kinliuren/llms.txt Calculates a day-based盤局 (panju), using the month stem-branch as the day and the day stem-branch as the hour. This is suitable for assessing the fortune of a single day. It prints the date, patterns, horse, and heaven-earth盤 (pan) configurations. ```python from kinliuren import kinliuren # Spring Equinox solar term, Lunar February, Gui Mao month, Geng Shen day lr = kinliuren.Liuren("春分", "二", "癸卯", "庚申") # Get day-based result day_result = lr.result_d(0) print(f"日期: {day_result['日期']}") # Format: Gui Mao month Geng Shen day print(f"格局: {day_result['格局']}") print(f"日馬: {day_result['日馬']}") # Heaven-earth盤 (pan) configuration tian_di_pan = day_result['天地盤'] print(f"天盤: {tian_di_pan['天盤']}") print(f"地盤: {tian_di_pan['地盤']}") print(f"天將: {tian_di_pan['天將']}") ``` -------------------------------- ### Get Month-Based Result (result_m) Source: https://context7.com/kentang2017/kinliuren/llms.txt Calculates a month-based盤局 (panju), using the day stem-branch as the hour and the hour stem-branch as the minute. This is suitable for assessing the fortune of an entire month. It prints the date, patterns, and the mappings for earth-to-heaven盤 (pan) and earth-to-heaven general. ```python from kinliuren import kinliuren # Start of Summer solar term, Lunar April, Bing Yin day, Ren Wu hour lr = kinliuren.Liuren("立夏", "四", "丙寅", "壬午") # Get month-based result month_result = lr.result_m(0) print(f"日期: {month_result['日期']}") # Format: Bing Yin hour Ren Wu minute print(f"格局: {month_result['格局']}") # Earth-to-heaven盤 (pan) mapping di_zhuan_tian = month_result['地轉天盤'] for di, tian in di_zhuan_tian.items(): print(f"地支 {di} -> 天盤 {tian}") # Earth-to-heaven general mapping di_zhuan_jiang = month_result['地轉天將'] for di, jiang in di_zhuan_jiang.items(): print(f"地支 {di} -> 天將 {jiang}") ``` -------------------------------- ### Get Time-Based Result (result) Source: https://context7.com/kentang2017/kinliuren/llms.txt Calculates a standard time-based盤局 (panju) using the day stem-branch as primary and hour stem-branch as secondary. Extracts and prints information about the three passes, four characters, and patterns. ```python from kinliuren import kinliuren # Winter Solstice solar term, Lunar November, Xin Wei day, Ji Hai hour lr = kinliuren.Liuren("冬至", "冬", "辛未", "己亥") # Get time-based result (0=daytime noble person, 1=nighttime noble person) result = lr.result(0) # Extract three passes information san_chuan = result['三傳'] print(f"初傳: {san_chuan['初傳'][0]} 天將:{san_chuan['初傳'][1]} 六親:{san_chuan['初傳'][2]}") print(f"中傳: {san_chuan['中傳'][0]} 天將:{san_chuan['中傳'][1]} 六親:{san_chuan['中傳'][2]}") print(f"末傳: {san_chuan['末傳'][0]} 天將:{san_chuan['末傳'][1]} 六親:{san_chuan['末傳'][2]}") # Extract four characters information si_ke = result['四課'] for ke in ['一課', '二課', '三課', '四課']: print(f"{ke}: {si_ke[ke][0]} 天將:{si_ke[ke][1]}") # Pattern determination print(f"格局: {result['格局']}") # Possible output: ['賊尅', '重審'], ['比用', '知一'], ['涉害', '涉害'] etc. ``` -------------------------------- ### Calculate Jinkou Jue (金口訣) Chart Source: https://context7.com/kentang2017/kinliuren/llms.txt This code calculates a Liu Ren Jinkou Jue chart using the `lr.jinkou()` method, starting with the earthly branch '子'. It prints the 'Ren Yuan', 'Gui Shen', 'Jiang Shen', and 'Di Fen' of the calculated chart. The Jinkou Jue chart layers are explained in the comments. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("立秋", "七", "癸亥", "乙卯") # 以地支「子」起課 zhi = "子" jinkou_result = lr.jinkou(zhi) print(f"人元: {jinkou_result['人元']}") print(f"貴神: {jinkou_result['貴神']}") # [干, 神名] print(f"將神: {jinkou_result['將神']}") # [干, 將名] print(f"地分: {jinkou_result['地分']}") ``` -------------------------------- ### all_sike() Method - Four Courses Calculation Source: https://context7.com/kentang2017/kinliuren/llms.txt The `all_sike()` method returns the raw calculation results for the four courses, including the stem-branch combinations for each course, used for advanced analysis. ```APIDOC ## all_sike() Method - Four Courses Calculation ### Description The `all_sike()` method returns the raw calculation results for the four courses, including the stem-branch combinations for each course, used for advanced analysis. ### Method `liuren.all_sike()` ### Parameters None ### Request Example ```python from kinliuren import kinliuren lr = kinliuren.Liuren("白露", "八", "甲子", "丙寅") # Get the raw four courses data sike = lr.all_sike() print("四課排列 (從四課到一課):") for i, ke in enumerate(sike, 1): print(f"第{5-i}課: 上神{ke[0]} 下神{ke[1]}") ``` ### Response #### Success Response (200) - **sike** (list) - A list of lists, where each inner list represents a course and contains the upper and lower stem-branches. #### Response Example ```json [ ["卯", "子"], ["子", "子"], ["卯", "寅"], ["寅", "甲"] ] ``` ### Output Example from Request ``` 四課排列 (從四課到一課): 第4課: 上神卯 下神子 第3課: 上神子 下神子 第2課: 上神卯 下神寅 第1課: 上神寅 下神甲 ``` ``` -------------------------------- ### Calculate Four Characters (all_sike) Source: https://context7.com/kentang2017/kinliuren/llms.txt Retrieves the raw calculation results for the four characters (Si Ke), including the stem-branch combinations for each character from the fourth to the first. This is useful for advanced analysis. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("白露", "八", "甲子", "丙寅") # Get raw four characters data sike = lr.all_sike() print("四課排列 (從四課到一課):") for i, ke in enumerate(sike, 1): print(f"第{5-i}課: 上神{ke[0]} 下神{ke[1]}") # Example output: # 四課排列 (從四課到一課): # 第4課: 上神卯 下神子 # 第3課: 上神子 下神子 # 第2課: 上神卯 下神寅 # 第1課: 上神寅 下神甲 ``` -------------------------------- ### result_m() Method - Month Chart Calculation Source: https://context7.com/kentang2017/kinliuren/llms.txt The `result_m()` method calculates a month chart, where the day stem-branch is treated as the hour and the hour stem-branch as the minute. This is suitable for analyzing the fortunes of an entire month. ```APIDOC ## result_m() Method - Month Chart Calculation ### Description The `result_m()` method calculates a month chart, where the day stem-branch is treated as the hour and the hour stem-branch as the minute. This is suitable for analyzing the fortunes of an entire month. ### Method `liuren.result_m(noble_person_method)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **noble_person_method** (integer) - Required - Specifies the method for calculating the noble person. Typically `0` for day noble person and `1` for night noble person. ### Request Example ```python from kinliuren import kinliuren # Start of Summer solar term, 4th Lunar month, Bing Yin day, Ren Wu hour lr = kinliuren.Liuren("立夏", "四", "丙寅", "壬午") # Get the month chart result month_result = lr.result_m(0) print(f"日期: {month_result['日期']}") # Format: 丙寅時壬午分 print(f"格局: {month_result['格局']}") # Terrestrial to celestial plate mapping di_zhuan_tian = month_result['地轉天盤'] for di, tian in di_zhuan_tian.items(): print(f"地支 {di} -> 天盤 {tian}") # Terrestrial to celestial general mapping di_zhuan_jiang = month_result['地轉天將'] for di, jiang in di_zhuan_jiang.items(): print(f"地支 {di} -> 天將 {jiang}") ``` ### Response #### Success Response (200) - **month_result** (dict) - A dictionary containing the month chart details, including: - '日期' (string): Time in stem-branch format. - '格局' (list): Identified chart patterns. - '地轉天盤' (dict): Terrestrial to celestial plate mapping. - '地轉天將' (dict): Terrestrial to celestial general mapping. #### Response Example ```json { "日期": "丙寅時壬午分", "格局": ["涉害", "涉害"], "地轉天盤": {"午": "亥", "未": "子", "申": "丑", "酉": "寅", "戌": "卯", "亥": "辰", "子": "巳", "丑": "午", "寅": "未", "卯": "申", "辰": "酉", "巳": "戌"}, "地轉天將": {"午": "蛇", "未": "貴", "申": "后", "酉": "陰", "戌": "玄", "亥": "常", "子": "虎", "丑": "空", "寅": "龍", "卯": "勾", "辰": "合", "巳": "雀"} } ``` ``` -------------------------------- ### result() Method - Time Chart Calculation Source: https://context7.com/kentang2017/kinliuren/llms.txt The `result()` method calculates a standard time chart, using the day stem-branch as the primary reference and the hour stem-branch as secondary. It returns a dictionary containing comprehensive information such as patterns, three passes, four courses, and celestial/terrestrial plates. ```APIDOC ## result() Method - Time Chart Calculation ### Description The `result()` method calculates a standard time chart, using the day stem-branch as the primary reference and the hour stem-branch as secondary. It returns a dictionary containing comprehensive information such as patterns, three passes, four courses, and celestial/terrestrial plates. ### Method `liuren.result(noble_person_method)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **noble_person_method** (integer) - Required - Specifies the method for calculating the noble person. Typically `0` for day noble person and `1` for night noble person. ### Request Example ```python from kinliuren import kinliuren # Winter Solstice solar term, Winter lunar month, Xin Wei day, Ji Hai hour lr = kinliuren.Liuren("冬至", "冬", "辛未", "己亥") # Get the time chart result (0=day noble person, 1=night noble person) result = lr.result(0) # Extract three passes information san_chuan = result['三傳'] print(f"初傳: {san_chuan['初傳'][0]} 天將:{san_chuan['初傳'][1]} 六親:{san_chuan['初傳'][2]}") print(f"中傳: {san_chuan['中傳'][0]} 天將:{san_chuan['中傳'][1]} 六親:{san_chuan['中傳'][2]}") print(f"末傳: {san_chuan['末傳'][0]} 天將:{san_chuan['末傳'][1]} 六親:{san_chuan['末傳'][2]}") # Extract four courses information si_ke = result['四課'] for ke in ['一課', '二課', '三課', '四課']: print(f"{ke}: {si_ke[ke][0]} 天將:{si_ke[ke][1]}") # Pattern judgment print(f"格局: {result['格局']}") # Possible output: ['賊尅', '重審'], ['比用', '知一'], ['涉害', '涉害'] etc. ``` ### Response #### Success Response (200) - **result** (dict) - A dictionary containing the time chart details, including: - '三傳' (dict): Information about the initial, middle, and final passes. - '四課' (dict): Details of the four courses. - '格局' (list): Identified chart patterns. #### Response Example ```json { "三傳": { "初傳": ["巳", "虎", "父", "丁"], "中傳": ["戌", "雀", "兄", "壬"], "末傳": ["卯", "玄", "官", "乙"] }, "四課": { "四課": ["巳子", "虎"], "三課": ["子未", "貴"], "二課": ["巳子", "虎"], "一課": ["子己", "貴"] }, "格局": ["賊尅", "重審"] } ``` ``` -------------------------------- ### sky_n_earth_list() Method - Celestial and Terrestrial Plate Mapping Source: https://context7.com/kentang2017/kinliuren/llms.txt The `sky_n_earth_list()` method returns a dictionary mapping the terrestrial plate to the celestial plate, which is the most basic information for a Liuren chart. ```APIDOC ## sky_n_earth_list() Method - Celestial and Terrestrial Plate Mapping ### Description The `sky_n_earth_list()` method returns a dictionary mapping the terrestrial plate to the celestial plate, which is the most basic information for a Liuren chart. ### Method `liuren.sky_n_earth_list()` ### Parameters None ### Request Example ```python from kinliuren import kinliuren lr = kinliuren.Liuren("秋分", "八", "壬申", "庚戌") # Get the celestial and terrestrial plate mapping sky_earth = lr.sky_n_earth_list() print("地盤 -> 天盤 對應表:") for earth, sky in sky_earth.items(): print(f"地支 {earth} 上臨天盤 {sky}") # The starting position of the celestial plate is determined by the moon general and the hour branch moon_general = lr.moongeneral() print(f"\n月將: {moon_general}") ``` ### Response #### Success Response (200) - **sky_earth** (dict) - A dictionary where keys are earthly branches of the terrestrial plate and values are the corresponding earthly branches of the celestial plate. - **moon_general** (string) - The moon general. #### Response Example ```json { "sky_earth": {"午": "亥", "未": "子", "申": "丑", "酉": "寅", "戌": "卯", "亥": "辰", "子": "巳", "丑": "午", "寅": "未", "卯": "申", "辰": "酉", "巳": "戌"}, "moon_general": "蛇" } ``` ``` -------------------------------- ### result_d() Method - Day Chart Calculation Source: https://context7.com/kentang2017/kinliuren/llms.txt The `result_d()` method is used to calculate a day chart, where the month stem-branch is treated as the day and the day stem-branch as the hour. This is suitable for analyzing the fortunes of a single day. ```APIDOC ## result_d() Method - Day Chart Calculation ### Description The `result_d()` method is used to calculate a day chart, where the month stem-branch is treated as the day and the day stem-branch as the hour. This is suitable for analyzing the fortunes of a single day. ### Method `liuren.result_d(noble_person_method)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **noble_person_method** (integer) - Required - Specifies the method for calculating the noble person. Typically `0` for day noble person and `1` for night noble person. ### Request Example ```python from kinliuren import kinliuren # Spring Equinox solar term, 2nd Lunar month, Gui Mao month, Geng Shen day lr = kinliuren.Liuren("春分", "二", "癸卯", "庚申") # Get the day chart result day_result = lr.result_d(0) print(f"日期: {day_result['日期']}") # Format: 癸卯月庚申日 print(f"格局: {day_result['格局']}") print(f"日馬: {day_result['日馬']}") # Celestial and terrestrial plate configuration tian_di_pan = day_result['天地盤'] print(f"天盤: {tian_di_pan['天盤']}") print(f"地盤: {tian_di_pan['地盤']}") print(f"天將: {tian_di_pan['天將']}") ``` ### Response #### Success Response (200) - **day_result** (dict) - A dictionary containing the day chart details, including: - '日期' (string): Date in stem-branch format. - '格局' (list): Identified chart patterns. - '日馬' (string): Day horse. - '天地盤' (dict): Celestial and terrestrial plates. #### Response Example ```json { "日期": "癸卯月庚申日", "格局": ["比用", "知一"], "日馬": "申", "天地盤": { "天盤": ["亥", "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌"], "地盤": ["午", "未", "申", "酉", "戌", "亥", "子", "丑", "寅", "卯", "辰", "巳"], "天將": ["蛇", "貴", "后", "陰", "玄", "常", "虎", "空", "龍", "勾", "合", "雀"] } } ``` ``` -------------------------------- ### Format Liuren Solar Term Source: https://github.com/kentang2017/kinliuren/blob/master/README.md This snippet demonstrates how to format Liuren divination results using solar terms, lunar month, day ganzi, and hour ganzi. It requires the kinliuren library to be imported. ```python result = kinliuren.Liuren("驚蟄", "二", "己未", "甲午").result(0) print(result) ``` -------------------------------- ### Core Chart Calculation Logic in Streamlit App Source: https://context7.com/kentang2017/kinliuren/llms.txt This Python snippet shows the core logic for calculating Liu Ren charts within the Streamlit app. It retrieves current date and time information, calculates solar terms and lunar months, and then computes three types of charts: month, day, and hour charts, printing their respective 'geju' (格局). ```python import jieqi from kinliuren import kinliuren # 獲取當前時間的干支資訊 y, m, d, h, mi = 2024, 3, 15, 10, 30 qgz = jieqi.gangzhi(y, m, d, h, mi) # 返回 [年干支, 月干支, 日干支, 時干支, 分干支] jq = jieqi.jq(y, m, d, h, mi) # 獲取節氣 cm = jieqi.lunar_date_d(y, m, d).get("農曆月") # 獲取農曆月 # 計算三種課式 month_chart = kinliuren.Liuren(jq, cm, qgz[1], qgz[2]).result_d(0) # 月課 day_chart = kinliuren.Liuren(jq, cm, qgz[2], qgz[3]).result(0) # 日課 hour_chart = kinliuren.Liuren(jq, cm, qgz[3], qgz[4]).result_m(0) # 時課 print(f"月課格局: {month_chart['格局']}") print(f"日課格局: {day_chart['格局']}") print(f"時課格局: {hour_chart['格局']}") ``` -------------------------------- ### Determine Ze Ke Pattern (zeike) Source: https://context7.com/kentang2017/kinliuren/llms.txt Determines if a Ze Ke (賊尅) pattern is present, including sub-categories like Yuan Shou and Chong Shen. This is the first pattern method in the nine major schools of Liuren. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("大暑", "六", "乙巳", "戊寅") ``` -------------------------------- ### Determine Zeike Ke (賊尅課) Source: https://context7.com/kentang2017/kinliuren/llms.txt This snippet demonstrates how to determine if a Liu Ren chart is a 'Zeike Ke' using the `lr.zeike()` method. It prints the chart's components if it is a Zeike Ke, otherwise, it indicates that it's not and suggests trying other methods. The conditions for Zeike Ke are commented in the code. ```python result = lr.zeike() if result != "不適用,或試他法": print(f"課體: {result[0]}") print(f"細分格局: {result[1]}") print(f"三傳: {result[2]}") else: print("非賊尅課,需試用其他課法") ``` -------------------------------- ### Derive Three Passes (find_three_pass) Source: https://context7.com/kentang2017/kinliuren/llms.txt Derives the complete three passes (initial, middle, final) based on the initial pass's earthly branch, using the heaven-earth盤 (pan) correspondence for recursive calculation. ```python from kinliuren import kinliuren lr = kinliuren.Liuren("處暑", "七", "戊辰", "甲寅") # Assume the initial pass is "巳", derive the three passes first_pass = "巳" three_passes = lr.find_three_pass(first_pass) print(f"初傳: {three_passes[0]}") print(f"中傳: {three_passes[1]}") print(f"末傳: {three_passes[2]}") # Principle of three passes derivation: # Initial pass -> Heaven盤 (pan) correspondence -> Middle pass # Middle pass -> Heaven盤 (pan) correspondence -> Final pass ``` -------------------------------- ### Liuren Class - Core Da Liuren Chart Generation Source: https://context7.com/kentang2017/kinliuren/llms.txt The Liuren class is the central component of the kinliuren library. It calculates a complete Da Liuren chart based on solar terms, lunar month, day stem-branch, and hour stem-branch. It automatically derives the three passes, four courses, celestial and terrestrial plates, twelve celestial generals, and various divine stars. ```APIDOC ## Liuren Class - Core Da Liuren Chart Generation ### Description The `Liuren` class is the central component of the kinliuren library. It calculates a complete Da Liuren chart based on solar terms, lunar month, day stem-branch, and hour stem-branch. It automatically derives the three passes, four courses, celestial and terrestrial plates, twelve celestial generals, and various divine stars. ### Method `kinliuren.Liuren(solar_term, lunar_month, day_stem_branch, hour_stem_branch)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **solar_term** (string) - Required - The current solar term (e.g., "驚蟄"). - **lunar_month** (string) - Required - The current lunar month (e.g., "二"). - **day_stem_branch** (string) - Required - The stem-branch for the day (e.g., "己未"). - **hour_stem_branch** (string) - Required - The stem-branch for the hour (e.g., "甲午"). ### Request Example ```python from kinliuren import kinliuren # Initialize Liuren class # Parameters: solar term, lunar month, day stem-branch, hour stem-branch liuren = kinliuren.Liuren("驚蟄", "二", "己未", "甲午") # Get the complete chart result (parameter 0 for day noble person calculation method) result = liuren.result(0) print(result) ``` ### Response #### Success Response (200) - **result** (dict) - A dictionary containing the complete Da Liuren chart information, including: - '節氣' (string): Solar term. - '日期' (string): Date and time in stem-branch format. - '格局' (list): List of chart patterns. - '日馬' (string): Day horse. - '三傳' (dict): Three passes (initial, middle, final). - '四課' (dict): Four courses. - '天地盤' (dict): Celestial and terrestrial plates. - '地轉天盤' (dict): Terrestrial to celestial plate mapping. - '地轉天將' (dict): Terrestrial to celestial general mapping. #### Response Example ```json { "節氣": "驚蟄", "日期": "己未日甲午時", "格局": ["賊尅", "重審"], "日馬": "巳", "三傳": { "初傳": ["巳", "虎", "父", "丁"], "中傳": ["戌", "雀", "兄", "壬"], "末傳": ["卯", "玄", "官", "乙"] }, "四課": { "四課": ["巳子", "虎"], "三課": ["子未", "貴"], "二課": ["巳子", "虎"], "一課": ["子己", "貴"] }, "天地盤": { "天盤": ["亥", "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌"], "地盤": ["午", "未", "申", "酉", "戌", "亥", "子", "丑", "寅", "卯", "辰", "巳"], "天將": ["蛇", "貴", "后", "陰", "玄", "常", "虎", "空", "龍", "勾", "合", "雀"] }, "地轉天盤": {"午": "亥", "未": "子", ...}, "地轉天將": {"午": "蛇", "未": "貴", ...} } ``` ``` -------------------------------- ### zeike() Method - Zeike Course Judgment Source: https://context7.com/kentang2017/kinliuren/llms.txt The `zeike()` method determines if a course is a 'Zeike' (賊尅) course, including sub-categories like Yuan Shou and Chong Shen. This is the first type of course method in the nine major schools of Liuren. ```APIDOC ## zeike() Method - Zeike Course Judgment ### Description The `zeike()` method determines if a course is a 'Zeike' (賊尅) course, including sub-categories like Yuan Shou and Chong Shen. This is the first type of course method in the nine major schools of Liuren. ### Method `liuren.zeike()` ### Parameters None ### Request Example ```python from kinliuren import kinliuren lr = kinliuren.Liuren("大暑", "六", "乙巳", "戊寅") # The zeike() method is typically called internally by result() or other chart generation methods. # Direct usage might require specific context or parameters not detailed here. # Example of checking if a specific course is Zeike (conceptual): # if lr.zeike(course_details): # print("This course is Zeike.") ``` ### Response #### Success Response (200) - The method likely returns a boolean or a specific pattern identifier if the condition is met. The exact return value depends on its internal implementation within the library. #### Response Example (Conceptual - actual return value may vary) ```json true ``` ``` -------------------------------- ### find_three_pass() Method - Three Passes Calculation Source: https://context7.com/kentang2017/kinliuren/llms.txt The `find_three_pass()` method calculates the complete three passes (initial, middle, and final) based on the initial pass's earthly branch, using the mapping relationship between the celestial and terrestrial plates for recursive derivation. ```APIDOC ## find_three_pass() Method - Three Passes Calculation ### Description The `find_three_pass()` method calculates the complete three passes (initial, middle, and final) based on the initial pass's earthly branch, using the mapping relationship between the celestial and terrestrial plates for recursive derivation. ### Method `liuren.find_three_pass(initial_pass_earthly_branch)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **initial_pass_earthly_branch** (string) - Required - The earthly branch of the initial pass (e.g., "巳"). ### Request Example ```python from kinliuren import kinliuren lr = kinliuren.Liuren("處暑", "七", "戊辰", "甲寅") # Assume the initial pass is "巳", calculate the three passes first_pass = "巳" three_passes = lr.find_three_pass(first_pass) print(f"初傳: {three_passes[0]}") print(f"中傳: {three_passes[1]}") print(f"末傳: {three_passes[2]}") # Principle of three passes calculation: # Initial pass -> Celestial plate mapping -> Middle pass # Middle pass -> Celestial plate mapping -> Final pass ``` ### Response #### Success Response (200) - **three_passes** (list) - A list containing the initial, middle, and final passes. #### Response Example ```json ["巳", "戌", "卯"] ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.