{ "cells": [ { "cell_type": "markdown", "id": "02bd10a2", "metadata": {}, "source": [ "# Test Claude" ] }, { "cell_type": "markdown", "id": "2c62e2cb", "metadata": {}, "source": [ "Assuming that the user has input the topic, and retrieved relevant articles (prepints)" ] }, { "cell_type": "code", "execution_count": 15, "id": "15a030b4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'title': \"Galactic Trajectories of Interstellar Objects 1I/'Oumuamua, 2I/Borisov, and 3I/Atlas\",\n", " 'abstract': 'The first interstellar objects, 1I/`Oumuamua, 2I/Borisov and 3I/ATLAS, were discovered over the past decade. We follow the trajectories of known interstellar objects in the gravitational potential of the Milky Way galaxy to constrain their possible origin. We perform Monte Carlo orbital integrations using 10,000 trajectory ensembles per object to properly account for measurement uncertainties in both object velocities and Solar motion parameters. We implement a Bayesian statistical framework that combines a Rayleigh-like likelihood function with star formation rate priors to infer stellar ages from the maximum vertical excursions ($z_{\\\\text{max}}$) of orbital trajectories. The likelihood function incorporates age-dependent velocity dispersions reflecting the thin-thick disk transition and dynamical heating over galactic history. Our Monte Carlo analysis yields median $z_{\\\\text{max}}$ values of 0.016 $\\\\pm$ 0.002 kpc for 1I/`Oumuamua, 0.121 $\\\\pm$ 0.010 kpc for 2I/Borisov, and 0.480 $\\\\pm$ 0.020 kpc for 3I/ATLAS. The Bayesian age inference indicates that 1I/`Oumuamua originated from a young stellar system (1.0 Gyr, 68\\\\% CI: 0.1-4.1 Gyr), 2I/Borisov from an intermediate-age population (3.8 Gyr, 68\\\\% CI: 1.8-5.9 Gyr), and 3I/ATLAS from an old thick-disk source (9.6 Gyr, 68\\\\% CI: 7.8-10.3 Gyr). These results demonstrate clear age discrimination where smaller vertical excursions correspond to younger stellar origins.',\n", " 'year': 2024}" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import json\n", "\n", "# for now, only title, abstract, year are used\n", "with open(\"example_paper.json\", \"r\") as f:\n", " paper_json = json.load(f)\n", "\n", "paper_json" ] }, { "cell_type": "code", "execution_count": 16, "id": "33e8e593", "metadata": {}, "outputs": [], "source": [ "# Initiate LLM (Anthropic)\n", "import dotenv\n", "import os\n", "dotenv.load_dotenv()\n", "ANTHROPIC_API_KEY = os.getenv(\"ANTHROPIC_API_KEY\")" ] }, { "cell_type": "code", "execution_count": 17, "id": "029828d3", "metadata": {}, "outputs": [], "source": [ "output_language = \"Chinese\"" ] }, { "cell_type": "code", "execution_count": 18, "id": "1637f2a1", "metadata": {}, "outputs": [], "source": [ "prompt = f\"\"\"\n", "Summarize this research paper in clear, accessible language:\n", "\n", "Title: {paper_json[\"title\"]}\n", "Year: {paper_json[\"year\"]}\n", "\n", "Abstract:\n", "{paper_json[\"abstract\"]}\n", "\n", "Provide a concise summary (2-3 paragraphs) that:\n", "1. Explains what problem the research addresses\n", "2. Describes the key methodology or approach\n", "3. Highlights the main findings and their significance\n", "\n", "Write for a general audience interested in science.\n", "\n", "Please respond in {output_language}.\n", "\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 19, "id": "91adcaad", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# 星际物体银河轨迹研究总结\n", "\n", "## 研究问题\n", "\n", "本研究针对一个引人入胜的天文谜题:过去十年里发现的三个星际物体(`Oumuamua、Borisov和ATLAS)来自哪里?这些物体来自我们太阳系之外,穿过银河系。科学家们想通过追踪它们在银河系中的运动轨迹,推断出它们的起源和年龄。\n", "\n", "## 研究方法\n", "\n", "研究人员采用了一种精密的计算方法。他们对每个物体进行了10,000次轨道模拟,以考虑测量数据中的不确定性。关键创新在于结合贝叶斯统计框架——一种处理概率的数学方法——与银河系恒星形成速率数据。通过分析这些物体在银河系中垂直方向的最大偏离距离,结合考虑不同年代恒星的运动特性差异,他们能够推断出这些物体的起源年代。\n", "\n", "## 主要发现\n", "\n", "研究结果显示出清晰的模式:`Oumuamua来自非常年轻的恒星系统(约10亿年),Borisov来自中等年龄的恒星(约38亿年),而ATLAS来自非常古老的银河系厚盘结构(约96亿年)。这一发现意义重大,因为它表明通过测量星际物体的银河轨道特征,科学家们可以推断这些神秘访客的起源时间和源头恒星的年龄——为理解宇宙中物质如何在星系间传播提供了新的洞见。\n" ] } ], "source": [ "import anthropic\n", "\n", "client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY)\n", "message = client.messages.create(\n", " model=\"claude-haiku-4-5\",\n", " max_tokens=4000,\n", " messages=[\n", " {\n", " \"role\": \"user\",\n", " \"content\": prompt\n", " }\n", " ]\n", ")\n", "\n", "print(message.content[0].text)" ] }, { "cell_type": "code", "execution_count": null, "id": "6f701bb5", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 20, "id": "1fe86509", "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "# 星际物体银河轨迹研究总结\n", "\n", "## 研究问题\n", "\n", "本研究针对一个引人入胜的天文谜题:过去十年里发现的三个星际物体(`Oumuamua、Borisov和ATLAS)来自哪里?这些物体来自我们太阳系之外,穿过银河系。科学家们想通过追踪它们在银河系中的运动轨迹,推断出它们的起源和年龄。\n", "\n", "## 研究方法\n", "\n", "研究人员采用了一种精密的计算方法。他们对每个物体进行了10,000次轨道模拟,以考虑测量数据中的不确定性。关键创新在于结合贝叶斯统计框架——一种处理概率的数学方法——与银河系恒星形成速率数据。通过分析这些物体在银河系中垂直方向的最大偏离距离,结合考虑不同年代恒星的运动特性差异,他们能够推断出这些物体的起源年代。\n", "\n", "## 主要发现\n", "\n", "研究结果显示出清晰的模式:`Oumuamua来自非常年轻的恒星系统(约10亿年),Borisov来自中等年龄的恒星(约38亿年),而ATLAS来自非常古老的银河系厚盘结构(约96亿年)。这一发现意义重大,因为它表明通过测量星际物体的银河轨道特征,科学家们可以推断这些神秘访客的起源时间和源头恒星的年龄——为理解宇宙中物质如何在星系间传播提供了新的洞见。" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.display import Markdown, display\n", "display(Markdown(message.content[0].text))" ] } ], "metadata": { "kernelspec": { "display_name": "science-storyteller", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.19" } }, "nbformat": 4, "nbformat_minor": 5 }