Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- conda-forge
- defaults

- name: Install package (editable)
shell: micromamba-shell {0}
run: |
python -m pip install -e . --no-deps

- name: Run smoke tests
shell: micromamba-shell {0}
run: |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ cd ResearchCodes

### 2) Create the conda environment from `environment.yml`

Create a fresh environment:
Create a fresh environment and install `researchcodes` in editable mode:

```bash
conda env create -f environment.yml
conda activate researchcodes
python -m pip install -e . --no-deps
```
Notes:
- `environment.yml` is the source of truth for dependencies.
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,11 @@
"source": [
"import sys\n",
"from pathlib import Path\n",
"\n",
"# set up the system path to import the \n",
"# compile_standard_catalog module \n",
"extra = Path(\"..\").resolve()\n",
"sys.path.insert(0, str(extra))\n",
"\n",
"from compile_standard_catalog import (\n",
"from researchcodes import (\n",
" define_column_desc, \n",
" iter_multi_csv_chunks, \n",
" write_std_h5, \n",
")\n",
"\n",
"\n"
")"
]
},
{
Expand All @@ -36,18 +28,29 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 12,
"id": "ded1390c-30c1-439a-a321-b0194e3591ff",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# define magnitude column names\n",
"# Define magnitude column names\n",
"\n",
"# Note this magnitude column order is not necessarily\n",
"# to be the same as the column order in the text file. \n",
"\n",
"# It is OK as long as the filter names in \n",
"# `magnitude_column_names` matches `colnames` defined \n",
"# when reading the text file\n",
"\n",
"magnitude_column_names = [\n",
" \"mag_B\",\"mag_V\",\"mag_u\",\"mag_g\",\"mag_r\",\"mag_i\",\"mag_PanSTARRS_zs\",\"mag_PanSTARRS_Y\",\n",
" # emag 8个\n",
" \"emag_B\",\"emag_V\",\"emag_u\",\"emag_g\",\"emag_r\",\"emag_i\",\"emag_PanSTARRS_zs\",\"emag_PanSTARRS_Y\",\n",
" \"Johnson_B\", \"Johnson_V\",\n",
" \"SDSS_up\", \"SDSS_gp\", \"SDSS_rp\", \"SDSS_ip\",\n",
" \"PanSTARRS_zs\",\"PanSTARRS_Y\",\n",
" \"Johnson_B_err\", \"Johnson_V_err\",\n",
" \"SDSS_up_err\", \"SDSS_gp_err\", \"SDSS_rp_err\", \"SDSS_ip_err\",\n",
" \"PanSTARRS_zs_err\",\"PanSTARRS_Y_err\",\n",
"]\n",
"\n",
"# define h5 file column description\n",
Expand All @@ -71,22 +74,22 @@
" 'ra_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=2),\n",
" 'dec': Float32Col(shape=(), dflt=np.float32(0.0), pos=3),\n",
" 'dec_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=4),\n",
" 'mag_B': Float32Col(shape=(), dflt=np.float32(0.0), pos=5),\n",
" 'mag_V': Float32Col(shape=(), dflt=np.float32(0.0), pos=6),\n",
" 'mag_u': Float32Col(shape=(), dflt=np.float32(0.0), pos=7),\n",
" 'mag_g': Float32Col(shape=(), dflt=np.float32(0.0), pos=8),\n",
" 'mag_r': Float32Col(shape=(), dflt=np.float32(0.0), pos=9),\n",
" 'mag_i': Float32Col(shape=(), dflt=np.float32(0.0), pos=10),\n",
" 'mag_PanSTARRS_zs': Float32Col(shape=(), dflt=np.float32(0.0), pos=11),\n",
" 'mag_PanSTARRS_Y': Float32Col(shape=(), dflt=np.float32(0.0), pos=12),\n",
" 'emag_B': Float32Col(shape=(), dflt=np.float32(0.0), pos=13),\n",
" 'emag_V': Float32Col(shape=(), dflt=np.float32(0.0), pos=14),\n",
" 'emag_u': Float32Col(shape=(), dflt=np.float32(0.0), pos=15),\n",
" 'emag_g': Float32Col(shape=(), dflt=np.float32(0.0), pos=16),\n",
" 'emag_r': Float32Col(shape=(), dflt=np.float32(0.0), pos=17),\n",
" 'emag_i': Float32Col(shape=(), dflt=np.float32(0.0), pos=18),\n",
" 'emag_PanSTARRS_zs': Float32Col(shape=(), dflt=np.float32(0.0), pos=19),\n",
" 'emag_PanSTARRS_Y': Float32Col(shape=(), dflt=np.float32(0.0), pos=20),\n",
" 'Johnson_B': Float32Col(shape=(), dflt=np.float32(0.0), pos=5),\n",
" 'Johnson_V': Float32Col(shape=(), dflt=np.float32(0.0), pos=6),\n",
" 'SDSS_up': Float32Col(shape=(), dflt=np.float32(0.0), pos=7),\n",
" 'SDSS_gp': Float32Col(shape=(), dflt=np.float32(0.0), pos=8),\n",
" 'SDSS_rp': Float32Col(shape=(), dflt=np.float32(0.0), pos=9),\n",
" 'SDSS_ip': Float32Col(shape=(), dflt=np.float32(0.0), pos=10),\n",
" 'PanSTARRS_zs': Float32Col(shape=(), dflt=np.float32(0.0), pos=11),\n",
" 'PanSTARRS_Y': Float32Col(shape=(), dflt=np.float32(0.0), pos=12),\n",
" 'Johnson_B_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=13),\n",
" 'Johnson_V_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=14),\n",
" 'SDSS_up_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=15),\n",
" 'SDSS_gp_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=16),\n",
" 'SDSS_rp_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=17),\n",
" 'SDSS_ip_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=18),\n",
" 'PanSTARRS_zs_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=19),\n",
" 'PanSTARRS_Y_err': Float32Col(shape=(), dflt=np.float32(0.0), pos=20),\n",
" 'ipix': Int32Col(shape=(), dflt=np.int32(0), pos=21),\n",
" 'bucket': Int32Col(shape=(), dflt=np.int32(0), pos=22)}"
]
Expand Down Expand Up @@ -125,7 +128,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "416165d4-bb8c-466b-abe8-c85f02114537",
"metadata": {
"tags": []
Expand All @@ -135,12 +138,13 @@
"# csv column names\n",
"colnames = [\n",
" \"id_name\", \"ra\", \"ra_err\", \"dec\", \"dec_err\",\n",
" # nobs 8个\n",
" \"nobs_B\",\"nobs_V\",\"nobs_u\",\"nobs_g\",\"nobs_r\",\"nobs_i\",\"nobs_PanSTARRS_zs\",\"nobs_PanSTARRS_Y\",\n",
" # mag 8个\n",
" \"mag_B\",\"mag_V\",\"mag_u\",\"mag_g\",\"mag_r\",\"mag_i\",\"mag_PanSTARRS_zs\",\"mag_PanSTARRS_Y\",\n",
" # emag 8个\n",
" \"emag_B\",\"emag_V\",\"emag_u\",\"emag_g\",\"emag_r\",\"emag_i\",\"emag_PanSTARRS_zs\",\"emag_PanSTARRS_Y\",\n",
" \"Johnson_B\", \"Johnson_V\",\n",
" \"SDSS_up\", \"SDSS_gp\", \"SDSS_rp\", \"SDSS_ip\",\n",
" \"PanSTARRS_zs\",\"PanSTARRS_Y\",\n",
" \"Johnson_B_err\", \"Johnson_V_err\",\n",
" \"SDSS_up_err\", \"SDSS_gp_err\", \"SDSS_rp_err\", \"SDSS_ip_err\",\n",
" \"PanSTARRS_zs_err\",\"PanSTARRS_Y_err\",\n",
"]\n",
"\n",
"dataframe_iterator = iter_multi_csv_chunks(\n",
Expand All @@ -158,7 +162,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "2349f2b6-cae4-4eee-a4f1-cc033080993e",
"metadata": {
"tags": []
Expand All @@ -173,15 +177,15 @@
" \"version\": \"dr10\",\n",
" \"mag_system\": {\n",
" \"Johnson_BV\": \"Vega\", \n",
" \"SDSS_ugri\": \"AB\", \n",
" \"SDSS_ugri_primed\": \"AB\", \n",
" \"PanSTARRS_zsY\": \"AB\", \n",
" }, \n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "01200976-6664-47af-8868-a6c75ed283ec",
"metadata": {
"tags": []
Expand All @@ -190,7 +194,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1145d58e3b024d8ab904ee67ff969314",
"model_id": "3b1bbb836bc14e329189cd3d4cfd4720",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -204,12 +208,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a660e868200b4d369719f07206757394",
"model_id": "de28e8dc18aa44a3bc0fda04c0fc3596",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Chunks: 0%| "
"Chunks: 0%| | 0/777 [00:00<?, ?it/s]"
]
},
"metadata": {},
Expand All @@ -218,12 +222,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fa85bc70ff734c9cb736a567ced405a7",
"model_id": "01849ab9bb5149be8668fcc140683d74",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Chunks: 0%| "
"Chunks: 0%| | 0/825 [00:00<?, ?it/s]"
]
},
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 5,
"id": "30731961-2747-4074-871c-ea7be2ddfb2c",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import sys\n",
"import pandas as pd\n",
"import numpy as np\n",
"from pathlib import Path\n",
"\n",
"# set up the system path to import the \n",
"# compile_standard_catalog module \n",
"extra = Path(\"..\").resolve()\n",
"sys.path.insert(0, str(extra))\n",
"\n",
"from compile_standard_catalog import (\n",
"from researchcodes import (\n",
" define_column_desc, \n",
" iter_multi_csv_chunks, \n",
" write_std_h5, \n",
")\n",
"\n",
"\n"
")"
]
},
{
Expand Down Expand Up @@ -57,18 +50,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"id": "cc8772ef-cb16-4efa-a3ae-d1530942aba1",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "05700bea-d17e-4049-b1ef-e1de623e1415",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -100,7 +82,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "0191ee0c-5e97-48a0-9f0a-ce7560a08137",
"metadata": {},
"outputs": [],
Expand All @@ -116,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "38b43a9d-0e11-4551-be6b-aa820db327f4",
"metadata": {},
"outputs": [],
Expand All @@ -140,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "2a463e75-156f-4103-bd65-f4616147d094",
"metadata": {},
"outputs": [],
Expand All @@ -164,14 +146,22 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "ded1390c-30c1-439a-a321-b0194e3591ff",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# define magnitude column names\n",
"# Define magnitude column names\n",
"\n",
"# Note this magnitude column order is not necessarily\n",
"# to be the same as the column order in the text file. \n",
"\n",
"# It is OK as long as the filter names in \n",
"# `magnitude_column_names` matches `colnames` defined \n",
"# when reading the text file\n",
"\n",
"magnitude_column_names = [\n",
" \"SDSS_up\",\"SDSS_gp\",\"SDSS_rp\",\"SDSS_ip\",\"SDSS_zp\",\n",
" \"SDSS_up_err\",\"SDSS_gp_err\",\"SDSS_rp_err\",\"SDSS_ip_err\",\"SDSS_zp_err\",\n",
Expand All @@ -186,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "028b9e76-735f-4a60-9632-bdd370344af5",
"metadata": {},
"outputs": [
Expand All @@ -212,7 +202,7 @@
" 'bucket': Int32Col(shape=(), dflt=np.int32(0), pos=16)}"
]
},
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -231,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "1e3e364a-d139-463d-a592-3125a366abc9",
"metadata": {
"tags": []
Expand All @@ -245,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 22,
"id": "416165d4-bb8c-466b-abe8-c85f02114537",
"metadata": {
"tags": []
Expand Down Expand Up @@ -278,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 23,
"id": "2349f2b6-cae4-4eee-a4f1-cc033080993e",
"metadata": {
"tags": []
Expand All @@ -299,7 +289,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 24,
"id": "01200976-6664-47af-8868-a6c75ed283ec",
"metadata": {
"tags": []
Expand All @@ -308,7 +298,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8ec29b674b154dfe8d9d9807bc9e714d",
"model_id": "802eaaa133fd419a89881afb1300a434",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -322,12 +312,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "15543887849e4fd2ac570dca5a2a639b",
"model_id": "7272cb61947941e4977c8f21fa74add0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Chunks: 0%| "
"Chunks: 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
Expand Down
Binary file not shown.
Loading