Skip to content

Instantly share code, notes, and snippets.

@taldcroft
Created April 19, 2022 12:31
Show Gist options
  • Save taldcroft/d870443430466a96a8d5b2cbe5c1faf3 to your computer and use it in GitHub Desktop.
Save taldcroft/d870443430466a96a8d5b2cbe5c1faf3 to your computer and use it in GitHub Desktop.
Compare AGASC stars obs to kadi starcats
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from agasc.supplement.magnitudes import star_obs_catalogs\n",
"from kadi.commands import *"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 14.5 s, sys: 944 ms, total: 15.5 s\n",
"Wall time: 15.5 s\n"
]
}
],
"source": [
"%%time \n",
"star_obs_catalogs.load()\n",
"stars_obs_v1 = star_obs_catalogs.STARS_OBS"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 6.49 s, sys: 423 ms, total: 6.91 s\n",
"Wall time: 9.09 s\n"
]
}
],
"source": [
"%%time \n",
"stars_obs_v2 = get_starcats_as_table(unique=True)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"start, stop = '2003:010', '2022:050'"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"ok = (stars_obs_v1['mp_starcat_time'] > start) & (stars_obs_v1['mp_starcat_time'] < stop)\n",
"so_v1 = stars_obs_v1[ok]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"ok = ((stars_obs_v2['starcat_date'] > start) \n",
" & (stars_obs_v2['starcat_date'] < stop)\n",
" & np.isin(stars_obs_v2['type'], ['BOT', 'GUI']))\n",
"so_v2 = stars_obs_v2[ok]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"205205 205259\n"
]
}
],
"source": [
"print(len(so_v1), len(so_v2))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"times_v1 = set(so_v1['mp_starcat_time'])\n",
"times_v2 = set(so_v2['starcat_date'])"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(32625, 32633)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(times_v1), len(times_v2)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'2012:116:01:03:56.000',\n",
" '2012:116:01:15:05.473',\n",
" '2016:063:16:52:11.833',\n",
" '2016:208:06:32:01.987',\n",
" '2018:283:12:30:12.679',\n",
" '2020:148:01:00:06.000',\n",
" '2020:148:01:44:19.381',\n",
" '2020:148:03:20:19.381'}"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"times_v2 - times_v1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "d2df0004ee630a46de2935730c9c65ee0c09bd3f3b85f07c44dd36ceff3dbd5e"
},
"kernelspec": {
"display_name": "Python 3.8.12 ('ska3')",
"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.8.12"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment