Example SSSC github module, initially for getting interns started with
github, making Solar System-focused queries with the Rubin Science
Platform (RSP) and introduction to unit tests (via pytest
). Will grow into
a more generally useful module over time.
- Checkout out the code to somewhere suitable e.g.
~/git/
:cd ~/git/
git clone https://github.com/lsst-sssc/rsp_queries
- Create a virtual enviroment using e.g.
conda create --name <myenv> python=3.11
orpython -m venv <myenv>
- Activate with
conda active <myenv>
orsource <myenv>/bin/activate
(or<myenv>/Scripts/activate
on Windows) - Install an editable (in-place) development version of rsp_queries. This will allow you to run the code from the source directory. If you just want the source code installed so edits in the source code are automatically installed:
pip install -e .
If you are going to be editing documentation or modifying unit tests, it is best to install the full development version:
pip install -e '.[dev]'
While it is strongly recommended to run queries in the Notebook aspect within the RSP, there can be use cases where the user wants to access Rubin data from outside the RSP. The procedure for doing this is as follows:
(This only needs to be done once per user)
- Obtain an access token from the RSP (tokens generated prior to DP1 are no longer valid/were wiped) by clicking on
Security tokens
under your login name in the top right as shown in the screenshot below: - Click on the
Create Token
button, provide a name for your token such asrsp_READ
and make sure to tick theread:image
andread:tap
options, leave theExpires
option atNever
and then clickCreate
- Make a copy of the generated token (should begin with
gt-
) and store it in a safe place as there is no way to see it again (you would need to delete and recreate it again if you lose it) - Make sure that you don't commit the token to any git repositories...
In order to use the token to access the RSP externally, two environment variables need to be set before launching the IPython shell or Jupyter notebook. For bash
shells (Linux, MacOS X, Cygwin etc):
export ACCESS_TOKEN="<your token from above>"
export EXTERNAL_INSTANCE_URL="https://data.lsst.cloud/"
and for PowerShell (Windows):
$env:ACCESS_TOKEN="<your token from above>"
$env:EXTERNAL_INSTANCE_URL="https://data.lsst.cloud/"
(EXTERNAL_INSTANCE_URL
sets the prefix for all the TAP services in lsst.rsp
and is prefered to the RSP documentation instructions to set EXTERNAL_TAP_URL
as that was only for the TAP service and this would need to be repeated (but wasn't documented) for SSOTAP, ObsLocTAP etc; with EXTERNAL_INSTANCE_URL
, only one variable needs to be set. This is less applicable now with DP1 compared to DP0.2/0.3)