<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Iasmina Nemes on Medium]]></title>
        <description><![CDATA[Stories by Iasmina Nemes on Medium]]></description>
        <link>https://medium.com/@iasmina.nemes?source=rss-2e178e69b227------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wbnSeuElAcdYK8_N6HBSHg.jpeg</url>
            <title>Stories by Iasmina Nemes on Medium</title>
            <link>https://medium.com/@iasmina.nemes?source=rss-2e178e69b227------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 04:51:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iasmina.nemes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[7 things to consider when building a text2SQL system]]></title>
            <link>https://medium.com/@iasmina.nemes/7-things-to-consider-when-building-a-text2sql-system-5955f18e062d?source=rss-2e178e69b227------2</link>
            <guid isPermaLink="false">https://medium.com/p/5955f18e062d</guid>
            <dc:creator><![CDATA[Iasmina Nemes]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 15:44:13 GMT</pubDate>
            <atom:updated>2026-10-16T15:44:13.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ei4xDAgSP2JuK5Sf8kw_Cg.png" /></figure><p>In a heavily data driven world, leveraging AI for fast retrieval of insights through natural language is a strong use case, with the most practical system being a text to SQL translation tool since SQL databases dominate the data storage space.</p><p>To ensure a successful kick-off, there are some considerations that may not be obvious, especially for a new team with no prior text2sql experience.</p><ol><li><strong><em>Agentic</em></strong> — Prefer agentic to directed flows. This allows complex reasoning, flexible tool calls for more novel questions and can often also uncover data quality issues.</li><li><strong><em>Data dream team</em></strong> — Having a knowledgeable and seasoned data team to train the system on the data universe is essential. Similar to how LLMs are trained on world knowledge, a reliable text2SQL system needs quality inputs from human data domain experts to guide it along the way, so that it can arrive at a correct answer.</li><li><strong><em>Robust data inventory</em></strong> — Goes hand in hand with #2. No actual development should start without this. For the data domain in scope, it is essential to have clearly labelled data so that the agent can tap into it and understand what tables, columns, and join relationships are available. Each table and column should be described so that the LLM can reason and link a user question to actual tables and columns. Providing table join relationships is also paramount to avoid hallucination of tables or joining variables.</li><li><strong><em>Subset the schema</em></strong> — No robust text2SQL system should retrieve an entire schema to an LLM to generate a SQL, instead it should fetch a relevant subset of tables and columns. This should be one of very first modules built, and it absolutely needs #3 to be in place.</li><li><strong><em>Customise the SQL generation</em></strong> — There are various methods to produce a SQL query: generating SQL entirely from scratch, modifying a template, generating specific portions of it. The most optimal systems are those that customise the approach based on the use case and user question. This comes back to points #2 &amp; #3, where it’s essential to have clarity over the data domain and what’s required.</li><li><strong><em>SQL validation</em></strong> — Beyond specific guardrails that protect against SQL injection, enforce query time-outs, and limit results, a simple step before executing the query is syntax validation. Most database systems offer the EXPLAIN plan function which makes it seamless to check against SQL syntax violations and provide a clear feedback loop.</li><li><strong><em>Conversational element</em></strong> — A good user experience is one where the user feels like the text2SQL system can carry a real conversation and it’s not a black box: it can answer follow-up questions, it can reply back with clarification questions, it can explain its capabilities, and it can walk through its reasoning. This will make the difference between a robotic system that understands only one-off, targeted questions, and a system which retains context, the user can drill down into the data and refine their questions until they find what they’re looking for.</li></ol><p>Finally, building a robust text2sql system isn’t a one off build. It’s an iterative and evolving process that strikes a balance between determinism and pure LLM reasoning, can scale with no regression and loss of reliability. Teams that skip steps (such as #2 &amp; #3) tend to get a product shipped really fast, but quickly determine that the product fails on accuracy. Teams that get it right are the ones who treat the unglamorous foundations — the data inventory, the domain experts, the guardrails — as the actual product, and the agentic reasoning as what sits on top of it. Get that right, and text2SQL stops being a demo and starts being something your data team actually relies on.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5955f18e062d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Have More Information Than Ever — and Less Truth]]></title>
            <link>https://medium.com/@iasmina.nemes/we-have-more-information-than-ever-and-less-truth-8eea6cd11da5?source=rss-2e178e69b227------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eea6cd11da5</guid>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Iasmina Nemes]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 18:56:35 GMT</pubDate>
            <atom:updated>2026-10-03T19:59:02.570Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>A small experiment in pointing AI at the problem AI is making worse</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OwttdHazdo1-G9nleZjdww.jpeg" /></figure><p>In Yuval Noah Harari’s book, Nexus, there is a point that really stuck with me: nowadays, we have an exploding amount of information around us, but much less truth. Information networks were built to connect people and ideas, which is a dignified purpose, but comes at a cost: these networks are now greatly facilitating the spread of misinformation and outright fake accounts. Another angle of this is how slow and expensive truth is while lies are fast and cheap — to quote from Bergstrom &amp; West in their book ‘Calling Bullsh*t’: “Falsehood flies and the truth comes limping after”.</p><p>I think this gap between information and truth is one of the viruses of this century. AI-generated videos, fake stories, disinformation and misinformation turn viral with the help of engagement maximisation algorithms, and before anyone can call out the falsehood and correct it— it swings elections, influences key financial or medical decisions people take, amplifies discrimination, violence or even genocide.</p><p>What if we could use the same property that makes AI dangerous here and instead of generating more content, we could point AI to the content already out there and asked: <em>how much of this is actually true?</em></p><p>That’s the idea behind a small proof-of-concept tool I built using Google ADK framework — one agent with two tools. An LLM agent receives a text string, breaks it down into verifiable claims, and checks each claim using the two tools provided. The main tool searches queries against a few reputable or community based domains, while a second tool can search web urls and retrieve the text. The agent is instructed to cross check each claim based on 3 sources, reason against the search results and return an overall truthfulness score, as well as a reasoning summary and confidence level.</p><p>The appeal isn’t the score itself. It’s what becomes possible when something like this exists, robustly and at scale: an automatic AI generated evaluation that flags content sitting between “unverified” and “outright debunked”. While there is a risk of false positives or false negatives — the framing of AI generated estimates and community driven notes similar to what exists on X globally can help.</p><p><strong>Now, the catch. </strong>The system is only as trustworthy as the source domains it’s pointed at. This POC searches against 3 domains: Wikipedia, Snopes and Reuters fact checker. The domain list is flexible and can be expanded in the source code.</p><p>The freedom to pick domains can introduce bias and pretty much lead the tool to favour a certain ideology — this is a reason why using purely an LLM call to estimate truthfulness can expose significant bias as reliance is placed solely on the model. Providing more guardrails and grounding the agent to explore a well curated set of domains can provide more weighted, impartial results. “Well curated” for me means using a diverse, independent and reliable aggregation of sources that favour high editorial standards and enforce robust self-correction mechanisms.</p><p>To show a quick demo, I ran the tool against a tweet of a famous president that contained multiple outright falsehoods and manipulations:</p><p>“Patrick Moore, co-founder of Greenpeace: ‘The whole climate crisis is not only Fake News, it’s Fake Science. There is no climate crisis, there’s weather and climate all around the world, and in fact carbon dioxide is the main building block of all life.’ ”</p><p>And here is the result:</p><pre>{<br>  &quot;truthfulness_score&quot;: 15,<br>  &quot;reasoning&quot;: &quot;The quoted statement contains significant factual inaccuracies and misleading framing:\n\n1. ** Greenpeace Co-Founder Claim**: Describing Patrick Moore as a \&quot;co-founder of Greenpeace\&quot; is disputed. According to Greenpeace, the organization was founded in 1970 by Irving Stowe, Dorothy Stowe, Jim Bohlen, Paul Cote, and others. Moore joined in 1971 as a graduate student and crew member. While he became a prominent early member and president of Greenpeace Canada, Greenpeace explicitly denies that he was a co-founder. Moore left the organization in 1986 and subsequently became a paid lobbyist and spokesperson for industries (nuclear, timber, mining, plastics) opposing Greenpeace&#39;s stance.\n\n2. **Climate Crisis / \&quot;Fake Science\&quot; Claim**: The claim that the climate crisis is \&quot;Fake Science\&quot; and \&quot;there is no climate crisis\&quot; directly contradicts the overwhelming consensus of climate science. Major international and national scientific bodies, including the Intergovernmental Panel on Climate Change (IPCC), NASA, and national science academies worldwide, agree that human emissions of greenhouse gases are causing rapid, unprecedented global warming and severe climate disruption.\n\n3. **Carbon Dioxide Claim**: Describing carbon dioxide strictly as the \&quot;main building block of all life\&quot; is misleadingly selective. While carbon compounds are essential to organic biology and plants use CO2 in photosynthesis, elevated concentrations of CO2 in the atmosphere trap thermal radiation, driving global climate change. Fact-checkers note that using CO2&#39;s biological role to deny its greenhouse impact is a common misleading talking point.\n\nBecause the statement misrepresents Moore&#39;s authority/affiliation, denies established climate science, and uses selective biological facts to obscure greenhouse warming risks, it is evaluated as highly misleading (Truthfulness Score: 15).&quot;,<br>  &quot;confidence&quot;: 95,<br>  &quot;sources_used&quot;: [<br>    {<br>      &quot;source&quot;: &quot;wikipedia&quot;,<br>      &quot;query&quot;: &quot;Patrick Moore Greenpeace co-founder&quot;,<br>      &quot;key_finding&quot;: &quot;Provides biography showing Patrick Moore was an early Greenpeace leader who left in 1986, became an industry consultant, and holds views at odds with mainstream climate science.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;snopes&quot;,<br>      &quot;query&quot;: &quot;Patrick Moore Greenpeace climate change&quot;,<br>      &quot;key_finding&quot;: &quot;Confirms Moore made these comments on Fox News (March 2019) and notes that Greenpeace explicitly disputes his claim to be a co-founder, identifying him as an early member who became a climate skeptic and industry lobbyist.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;reuters_fact_check&quot;,<br>      &quot;query&quot;: &quot;carbon dioxide climate crisis fake science&quot;,<br>      &quot;key_finding&quot;: &quot;Fact checks confirm that while CO2 is used by plants in photosynthesis, using this fact to claim climate change is a &#39;scam&#39; or non-existent is misleading, as atmospheric excess CO2 traps heat and causes severe global warming.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;wikipedia&quot;,<br>      &quot;query&quot;: &quot;scientific consensus on climate change&quot;,<br>      &quot;key_finding&quot;: &quot;Documents the broad consensus among world scientific bodies and the IPCC that human-produced CO2 drives global climate change.&quot;<br>    }<br>  ]<br>}</pre><p>The evaluation is fast, and can appear as a feature <strong>before</strong> users even make a post — as an alert how factually grounded the content they’re about to launch is. It’s still the choice of the user if they want to perform more due diligence or not, or include a “community notes” style appendix to their post with the reasons why the given evaluation is inaccurate, which can then trigger another evaluation.</p><p>Let’s check now a more well known fact, like <em>“Newton’s third law is that for every action there is an opposite and equal reaction”. </em>This gives the expected result.</p><pre>{<br>  &quot;truthfulness_score&quot;: 100,<br>  &quot;reasoning&quot;: &quot;The claim accurately states Newton&#39;s Third Law of Motion. According to standard physics and scientific consensus as documented on Wikipedia and referenced across fact-checking sources like Snopes, Newton&#39;s third law states that when two bodies interact, they apply forces to one another that are equal in magnitude and opposite in direction\u2014commonly formulated as &#39;for every action, there is an equal and opposite reaction&#39;.&quot;,<br>  &quot;confidence&quot;: 100,<br>  &quot;sources_used&quot;: [<br>    {<br>      &quot;source&quot;: &quot;wikipedia&quot;,<br>      &quot;query&quot;: &quot;Newton&#39;s third law of motion&quot;,<br>      &quot;key_finding&quot;: &quot;Newton&#39;s third law of motion states that if two bodies exert forces on each other, these forces have equal magnitude and opposite direction.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;snopes&quot;,<br>      &quot;query&quot;: &quot;Newton&#39;s third law action reaction&quot;,<br>      &quot;key_finding&quot;: &quot;Refers to Newton&#39;s third law as commonly stated: &#39;For every action there is an equal and opposite reaction.&#39;&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;reuters_fact_check&quot;,<br>      &quot;query&quot;: &quot;Newton law of motion&quot;,<br>      &quot;key_finding&quot;: &quot;No fact-check results found, as standard foundational physics principles are not subject to political/news fact checks.&quot;<br>    }<br>  ]<br>}</pre><p>A more interesting case is when a statement is factually true, but it’s not providing the full context and can mislead: <em>“Compared to Obama and Biden’s presidencies, Trump had the least number of days while in term with crude oil above $100”. </em>The answer correctly identifies the grounded truth, but the next stage would be to also score it against misleading context framing, and provide more concrete rules on the scoring mechanism.</p><pre>{<br>  &quot;truthfulness_score&quot;: 100,<br>  &quot;reasoning&quot;: &quot;The statement is factually accurate when examining historical crude oil benchmarks (such as West Texas Intermediate [WTI] and Brent Crude) during the presidencies of Barack Obama, Donald Trump, and Joe Biden:\n\n1. Donald Trump (Jan 20, 2017 \u2013 Jan 20, 2021): Crude oil prices never reached $100 per barrel during Trump&#39;s entire presidency. Peak prices during his term reached around $76/barrel for WTI and $86/barrel for Brent in October 2018. Thus, Trump had 0 days with crude oil above $100.\n\n2. Barack Obama (Jan 20, 2009 \u2013 Jan 20, 2017): Crude oil traded above $100 per barrel for extended periods between 2011 and 2014, accumulating well over 1,000 days for Brent and hundreds of days for WTI.\n\n3. Joe Biden (Jan 20, 2021 \u2013 present): Following Russia&#39;s invasion of Ukraine in early 2022, crude oil prices surged past $100 per barrel for several months (between March and July 2022), resulting in dozens to over 100 days above $100 per barrel.\n\nComparing the three, Trump had 0 days, which is indeed the least number of days with crude oil above $100 per barrel.&quot;,<br>  &quot;confidence&quot;: 95,<br>  &quot;sources_used&quot;: [<br>    {<br>      &quot;source&quot;: &quot;reuters_fact_check&quot;,<br>      &quot;query&quot;: &quot;Trump Obama Biden crude oil 100 dollars barrel&quot;,<br>      &quot;key_finding&quot;: &quot;Searched Reuters Fact Check archives for reports on presidential comparisons of crude oil prices.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;wikipedia&quot;,<br>      &quot;query&quot;: &quot;Crude oil prices Obama Trump Biden&quot;,<br>      &quot;key_finding&quot;: &quot;Confirmed historical oil price trends and chronologies during the Obama, Trump, and Biden administrations.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;snopes&quot;,<br>      &quot;query&quot;: &quot;Trump crude oil 100 dollars barrel Obama Biden&quot;,<br>      &quot;key_finding&quot;: &quot;Checked Snopes entries related to presidential gas and oil price claims.&quot;<br>    },<br>    {<br>      &quot;source&quot;: &quot;wikipedia&quot;,<br>      &quot;query&quot;: &quot;\&quot;Price of oil\&quot; WTI crude 100 dollars 2017 2021&quot;,<br>      &quot;key_finding&quot;: &quot;Verified that oil prices during the 2017\u20132021 period peaked under $90/barrel and did not cross $100/barrel, whereas prices crossed $100 in 2011\u20132014 (Obama) and 2022 (Biden).&quot;<br>    }<br>  ]<br>}</pre><p>This is a rough, early build, not a solution for the internet’s misinformation problem — more of an invitation to think about what it would take to build one properly.</p><p>GitHub link <a href="https://github.com/iasminanemes/content-scoring-agent">here</a>, let me know thoughts!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eea6cd11da5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using GAIA data to understand our galaxy]]></title>
            <link>https://medium.com/@iasmina.nemes/using-gaia-data-to-understand-our-galaxy-d2a8102f19d2?source=rss-2e178e69b227------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2a8102f19d2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[astrophysics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[astronomy]]></category>
            <dc:creator><![CDATA[Iasmina Nemes]]></dc:creator>
            <pubDate>Sat, 01 Feb 2025 19:31:41 GMT</pubDate>
            <atom:updated>2025-02-01T19:31:41.598Z</atom:updated>
            <content:encoded><![CDATA[<p>GAIA is a ESA project aimed at mapping our galaxy and beyond, through measurements taken by a set of optical telescopes located at the L2 Lagrangian point, shielded from the sun radiation and light. It’s pretty incredible that this data is recorded some 1.5 milion km away in space, sent back to Earth, and available to be queried &amp; downloaded freely on the GAIA archive site by anyone with a computer and internet connection.</p><p>The database contains highly specialised measurements, but the myriad resources on the GAIA site, such as the GAIA stories, data release documentation, etc. help untangle some of the data for astrophysics enthusiasts to digest.</p><p>For this analysis, I extracted several features available in GAIA data release 3 and downloaded a sample of 3 million stars:</p><pre>--SQL query--<br>select l,b,parallax,radial_velocity, teff_gspphot<br>from gaiadr3.gaia_source<br>where radial_velocity is not null<br>and parallax_over_error&gt;=10 --selecting parallax measurements with &lt;10% error</pre><p>Parallax is a key measure collected by GAIA because it enables the calculation of distances to each star object. It entails observing a star’s apparent positions at different points in time, measuring the angle between the line of sight and applying simple trigonometry (see Fig 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_NiCmGQ7O-jSnCL7PKRf9Q.png" /><figcaption>Fig. 1 Understanding parallax</figcaption></figure><p>The distance <strong><em>d</em></strong> can then be calculated using the definition of the tangent, resulting in the equation:</p><p>tan(⍺/2) = Distance Earth-Sun / <strong><em>d</em></strong> =&gt; <strong><em>d</em></strong> = 1 AU / tan(⍺/2)</p><p>Using the small angle approximation, we can estimate tan(⍺/2) ~ ⍺, and from here we can deduce that the distance <strong><em>d</em></strong> equals 1 / parallax, measured in kiloparsecs (kpc), where 1 kpc is equal to a monstrous 200 million times the average distance between Earth and the Sun.</p><p>The code used to generate the parallax figure is provided at the end.</p><p>Now back to the Gaia data. In Python, we can very quickly extract some interesting characteristics of our galaxy. For example, let’s map all the stars in our sample and color code them by distance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zssyzPKGCARS4hrHF_87yQ.png" /><figcaption>Fig. 2 A map of local stars</figcaption></figure><p>What is immediately visible is that there are much fewer stars more than 8 kpc away, which coincides with the center of our galaxy. Even though this is a sample with a filter on the parallax error, the result holds for all data release 3 population of GAIA stars with a parallax measurement, of which only ~14% are more than 8 kpc away. The explanation lies in the fact that at the center of the galaxy, there are large chunks of dust and gas clouds, which block the visibility of stars in that region, making them more difficult to catch. Future GAIA data releases though promise to show us a glimpse of what lies at the center of the galaxy and beyond, with a captivating initial view recently released <a href="https://www.esa.int/ESA_Multimedia/Images/2025/01/The_best_Milky_Way_map_by_Gaia_edge-on">here</a>.</p><p>Another feature that we can look at is radial velocity. Stars with negative radial velocity are moving towards us (are blueshifted) and those with positive radial velocity are moving away (redshifted). In the sample, the distribution of stars is quite pronounced in favour of blueshifted stars, as can be seen in Fig 3. This means that most stars in our galaxy are moving towards us, as the galaxy is condensing the matter closer together. So if we wanted to prove that the universe is expanding, we’d definitely have to go a lot further!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*z2dQOPpN3lMIfnUvV81GXw.png" /><figcaption>Fig. 3 Number of stars by red(blue)shift</figcaption></figure><p>Finally, let’s look at the temperature of stars in the sample. In Fig 4, we can distinguish 3 clusters, ranging from cooler stars like our Sun (red dwarfs) to hot, blue giant type stars. Hotter stars, which tend to be younger, are located between 1 and 6 kpc away from us, which aligns well with the notion that the majority of star formation regions are around the spiral arms of the galaxy.</p><p>We can also immediately see that most of the stars around us are red dwarfs like our Sun — in fact this is the case all around the universe, smaller, cooler stars are a lot more abundant than massive, hot stars, since they burn their fuel a lot slower, hence they have a much longer lifespan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*rjHuIIeHEmeuojRv8qftOg.png" /><figcaption>Fig. 4 Stars by temperature and distance</figcaption></figure><p>The code used to generate all the plots is available below. Thanks for reading! 🚀✨</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/641ecdadcc52738e64a5656f752d7410/href">https://medium.com/media/641ecdadcc52738e64a5656f752d7410/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2a8102f19d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[To move forward you sometimes have to seemingly move backward]]></title>
            <link>https://medium.com/@iasmina.nemes/to-move-forward-you-sometimes-have-to-apparently-move-backward-050b9b4f1005?source=rss-2e178e69b227------2</link>
            <guid isPermaLink="false">https://medium.com/p/050b9b4f1005</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-vizualisation]]></category>
            <category><![CDATA[astronomy]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Iasmina Nemes]]></dc:creator>
            <pubDate>Tue, 21 May 2024 18:22:12 GMT</pubDate>
            <atom:updated>2024-05-27T17:33:50.985Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learnings from our solar system</h4><blockquote>“We are all in the gutter, but some of us are looking at the stars.”</blockquote><blockquote>Oscar Wilde</blockquote><p>For centuries, our ancestors believed that our planet is at the centre of the solar system. The geocentric theory was conceptualised by the Greek astronomer Ptolemy in the 2nd century, and was the generally accepted view until the early 16th century, when Nicolaus Copernicus proposed the heliocentric model, based on observations of planets’ motion in the night sky, relative to other stars.</p><p>Copernicus realised that the only way to explain the apparent ‘backward’ motion of planets, a long standing conundrum that wasn’t properly addressed by the Ptolemaic system, was to completely change assumptions, and realise that Earth also revolves, like other planets, around the Sun.</p><p>In this article, I’ll create visuals of these concepts, and showcase how a wealth of data is readily available through various NASA APIs.</p><p>An example of backward motion is Mars during late 2022, for which I’ll use NASA’s JPL Horizons Python API to trace its path on the sky, as viewed from central London.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77d2278d35726a6dbb42abd7246fbba4/href">https://medium.com/media/77d2278d35726a6dbb42abd7246fbba4/href</a></iframe><p>Our dataframe df now contains declination and right ascension coordinates for each date between August 2022 – March 2023. Note that these coordinates are fixed for distant objects, being analogous to latitude and longitude on Earth. For solar system planets though, declination and right ascension coordinates do change over time due to the planets’ motion relative to the background stars.</p><p>Using plotly express, we can now plot Mars’ path relative to the stars during this period:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/628343481c451ec0554ed2710afe2fab/href">https://medium.com/media/628343481c451ec0554ed2710afe2fab/href</a></iframe><p>From the resulting plot in Fig 1, we can see Mars has been moving eastward (corresponding to a higher right-ascension coordinate) until early November 2022, when it started moving west, resuming its eastward direction in early 2023.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Rq5fxcJVI2sPTJyCj-ao1Q.png" /><figcaption>Fig 1: Mars apparent backward motion</figcaption></figure><p>This puzzled scientists for centuries. We now know that the apparent backward motion happens as Earth is in opposition (Earth is between the planet and the sun) with an outer planet and then overtakes it. This is a consequence of different orbital velocities and orbital period of planets as they revolve around the sun — the further the distance from the sun, the lower the velocity and the longer it takes for a planet to complete an orbit. These ideas are embedded into Kepler’s laws of planetary motion, discovered not long after Copernicus’ death, and certainly based on Copernicus’ years of research.</p><p>NASA’s planetary <a href="https://nssdc.gsfc.nasa.gov/planetary/factsheet/">factsheet</a> has key planet information that can help easily visualise this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85baab22f8152d7c5d4b16fb32dcb25d/href">https://medium.com/media/85baab22f8152d7c5d4b16fb32dcb25d/href</a></iframe><p>As expected, the orbital velocity of a planet decreases as its average distance from the Sun increases, following an inverse square root relationship (Pluto is a tiny dot in the bottom right corner, included for completeness).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*uae9q7Kl5DjNecljijhFvw.png" /><figcaption>Fig 2: Average distance from the sun vs orbital velocity</figcaption></figure><p>To wrap this up, let’s simulate Earth and Mars orbiting the Sun during 2022 — 2023 to further visualise what happens.</p><p>The Horizons API also provides vector location of planets with respect to points of reference, during specified time periods. We’ll use this to extract the positions of Earth and Mars relative to the sun between August 2022 — August 2023.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/468bf5be9893cf1983d3d3abf9acb828/href">https://medium.com/media/468bf5be9893cf1983d3d3abf9acb828/href</a></iframe><p>The animation in Fig 3 shows that Earth and Mars are in opposition around November 2022, after which Earth overtakes Mars, causing our view of Mars in the sky temporarily seeming to go backwards relative to other stars. This happens roughly every two years, while the rest of the outer planets are at opposition with Earth approximately every year.</p><p>Knowing the periodicity of opposition is useful for observing or actually visiting these planets, as it marks their closest approach with Earth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*8gE5cysGuVlUW4g1NVm3gQ.gif" /><figcaption>Fig 3: Earth overtaking Mars</figcaption></figure><p>That’s all for now, thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=050b9b4f1005" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python for astronomy: tracking night sky objects]]></title>
            <link>https://medium.com/@iasmina.nemes/python-for-astronomy-tracking-night-sky-objects-2880151762ac?source=rss-2e178e69b227------2</link>
            <guid isPermaLink="false">https://medium.com/p/2880151762ac</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[astronomy]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Iasmina Nemes]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 18:36:25 GMT</pubDate>
            <atom:updated>2024-04-17T17:32:17.076Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“Science is not only compatible with spirituality; it is a profound source of spirituality.” ― </em><strong><em>Carl Sagan</em></strong></p><p>To me, it always helped to reframe problems in life by just letting myself drift and get inspired while watching the night sky. I am lucky enough to have a spot where there is a good chance for a clear sky and moderate light pollution, where I can decompress and refocus myself on what matters.</p><p>It makes me realise how much bigger this whole space is and thousands of years from now, earth will look very different, yet the sky will be the same, the stars will keep moving, following the same paths and cycles. I find this carries something majestic to it, and an inspiration to appreciate the small things, such as simply having the chance to witness this.</p><p>Moving on from the spiritual angle, these thoughts made me curious to explore how could I simulate a star’s movement across the sky in Python based on a given date and location, and led me to discover the many powerful functions that come with the astropy package. It turns out, it is fairly simple to plot something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*jAFXKrLj_Zx9CxmgnWGvog.png" /><figcaption>Arcturus’ trajectory on the night sky based on selected location and datetime</figcaption></figure><p>The altitude measures how high on the sky the object is — above 0 means it’s above horizon, and 90 degrees corresponds to zenith. Arcturus is one of the brightest stars in the Northern hemisphere, and the plot shows its trajectory on the night sky throughout the night of 1st to 2nd of March as it rises from NE and sets in SW, as viewed from London (hoping for a clear sky!).</p><p>Let’s see how to do this!</p><p>First things first, there are a couple of packages required:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65590d8fcbd1886ab1a7dd2be56943cc/href">https://medium.com/media/65590d8fcbd1886ab1a7dd2be56943cc/href</a></iframe><p>Let’s define the main parameters, the star we want to track, our observation location and datetime. Feel free to adjust these parameters based on where you are and what you want to observe!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/486ed496670aff52eff896a38767bde8/href">https://medium.com/media/486ed496670aff52eff896a38767bde8/href</a></iframe><p>As a summary of what we’ll do next, we’ll use the SkyCoord database from astropy to extract the celestial coordinates of our object of interest for a 24h time frame starting from our observation date and time. By default, this is returned using declination and right-ascension. Under this coordinate system, stars have fixed declination and ascension coordinates regardless of the observer’s position on Earth. Therefore, we need to convert this to a different system where an object’s position in the sky takes into account the observation location on Earth: the alt-azimuth system (see Fig. 1). We obtain the same coordinates for the sun during the same timeframe, and exclude time intervals when the sun is above horizon, as the star is not visible. With this, we’ll pretty much have all the data and we can go into plotting, for which we’ll use the standard matplotlib, with some powerful customisation tools!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*lEZ4YFEKwKqZSsKJ6n66Xg.png" /><figcaption>Figure 1: The alt-az system, where the altitude measures how high in the sky the object is (from 0 to 90 degrees), and azimuth measures the orientation (running from 0 degrees north to 360 degrees moving eastward). More details <a href="https://en.wikipedia.org/wiki/Horizontal_coordinate_system">here</a></figcaption></figure><p>Before we do so, let’s see how we get the data ready step by step.</p><p>First, we need to convert our observation location to the geocentric coordinate system which is compatible with the alt-az coordinate system. The first step is to extract latitude and longitude of our location using geocode and then use EarthLocation provided in astropy to convert these to geocentric coordinates:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61ed953a20d60944d46eb1125c30285c/href">https://medium.com/media/61ed953a20d60944d46eb1125c30285c/href</a></iframe><p>Astropy functions expect dates and times based on UTC timezone, so we need to identify the time difference between our location and UTC, as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68e4667062a375a452ffdb846fcbc6fc/href">https://medium.com/media/68e4667062a375a452ffdb846fcbc6fc/href</a></iframe><p>Next, we generate 24h split into 10 minutes intervals starting from our observation date stamp.</p><p>Note here and in the timezone conversion code we’re using the astropy.units (u) to convert numbers to hours and minutes. Astropy.units can be used to convert pretty much anything to any unit, or do conversion from one unit to another using .to().</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ef873554a9b2f3711d0ab42502c854e/href">https://medium.com/media/0ef873554a9b2f3711d0ab42502c854e/href</a></iframe><p>Now we’re ready to extract the celestial coordinates of our object of interest and convert them to our alt-az frame of reference using the time intervals generated above and our geocentric based location:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b10ad5d9da8b35f9563914d9431ca8e/href">https://medium.com/media/8b10ad5d9da8b35f9563914d9431ca8e/href</a></iframe><p>We also need to exclude time intervals when the sun is above horizon, i.e. its altitude is above 0 in the alt-az system. To do this, we use the get_sun() function in astropy to return the sun dec-ra coordinates for our time intervals and convert them to our alt-az frame. Finally, we use this to extract only the night time coordinates of our star.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/659cf851bb032698ddc42f8541cf2349/href">https://medium.com/media/659cf851bb032698ddc42f8541cf2349/href</a></iframe><p>Last but not least, we’re using the basic scatter plot provided by matplotlib to visualize the star’s movement in the night sky, color coded by its direction of travel based on its azimuth coordinates, wrapped in a function together with the steps outlined above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5907c0acb618fd27523e89d2e85759a5/href">https://medium.com/media/5907c0acb618fd27523e89d2e85759a5/href</a></iframe><p>And here it is!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*jAFXKrLj_Zx9CxmgnWGvog.png" /></figure><p>Let’s test this with another star! Rigel is a blue supergiant, and it’s the brightest star in the Orion constellation. Orion is best visible from autumn to spring in the northern hemisphere and during summer in the southern hemisphere. It’s one of the most beautiful constellations, easy to spot on the night sky and it has many interesting objects to observe: Betelgeuse, which is a red giant and second most luminous in the constellation, and the famous Orion nebula, which is something short of incredible, even with a beginner’s telescope.</p><p>As you can see, on the London night sky on 1st of March, Rigel rises from the south and sets in west just before midnight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*WHs_ELLjmeWu-DMK06w9LA.png" /></figure><p>Now let’s move to the southern hemisphere, to Sydney, Australia, and try to observe the north star, Polaris.</p><p>The output is:</p><pre>&#39;Object not visible on selected location and date&#39;</pre><p>This is correct, as Polaris is actually only visible from the northern hemisphere. It’s very useful to know its position on the sky, as in case you need some self navigation, it will always show you the north. Its equivalent in the southern hemisphere is the southern cross or Crux constellation, which always shows south. Let’s test our function with the brightest star in the Crux constellation, alpha Crux, as viewed from Sydney, Australia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*24CKzNo798iCDqUCkREZUg.png" /></figure><p>And indeed, Alpha Crux is always oriented southwards, and visible throughout the night in the southern hemisphere.</p><p>While this article focused on one use case only, there’s a lot more areas that can be explored, such as:</p><p>- Using animation plots</p><p>- Plot multiple objects</p><p>- Plot the night sky</p><p>Thanks for reading and feel free to drop me any other suggestions or feedback!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2880151762ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>