Skip to content

Commit 5fbd738

Browse files
committed
Updated cosmosim docs.
1 parent 9fb1d49 commit 5fbd738

File tree

1 file changed

+50
-9
lines changed

1 file changed

+50
-9
lines changed

docs/cosmosim/cosmosim.rst

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,42 @@ Getting started
3131
3232
>>> from astroquery.cosmosim import CosmoSim
3333
>>> CS = CosmoSim()
34-
>>> # Next, enter your credentials; caching is enabled, so after
35-
>>> # the initial successful login no further password is required.
34+
35+
Next, enter your credentials; caching is enabled, so after the initial
36+
successful login no further password is required if desired.
37+
3638
>>> CS.login(username="uname")
3739
uname, enter your CosmoSim password:
3840

3941
Authenticating uname on www.cosmosim.org...
4042
Authentication successful!
41-
>>> # It also knows if you are running from a script. To login
42-
>>> # from a script (rather than an interactive python session):
43+
>>> # If running from a script (rather than an interactive python session):
4344
>>> # CS.login(username="uname",password="password")
44-
>>> # MDR1.BDMV mass function
45+
46+
To store the password associated with your username in the keychain:
47+
48+
>>> CS.login(username="uname",store_password=True)
49+
WARNING: No password was found in the keychain for the provided username. [astroquery.cosmosim.core]
50+
uname, enter your CosmoSim password:
51+
52+
Authenticating uname on www.cosmosim.org...
53+
Authentication successful!
54+
55+
Logging out is as simple as:
56+
57+
>>> CS.logout(deletepw=True)
58+
Removed password for uname in the keychain.
59+
60+
The deletepw option will undo the storage of any password in the
61+
keychain. Checking whether you are successfully logged in (or who is
62+
currently logged in):
63+
64+
>>> CS.check_login_status()
65+
Status: You are logged in as uname.
66+
67+
Below is an example of running an SQL query (BDMV mass function of the
68+
MDR1 cosmological simulation at a redshift of z=0):
69+
4570
>>> sql_query = "SELECT 0.25*(0.5+FLOOR(LOG10(mass)/0.25)) AS log_mass, COUNT(*) AS num FROM MDR1.FOF WHERE snapnum=85 GROUP BY FLOOR(LOG10(mass)/0.25) ORDER BY log_mass"
4671
>>> CS.run_sql_query(query_string=sql_query)
4772
Job created: 359748449665484 #jobid; note: is unique to each and
@@ -77,10 +102,10 @@ jobs.
77102
{'359748449665484': 'COMPLETED'}
78103
{'359748449682647': 'ABORTED'}
79104
80-
Additionally, 'delete_all_jobs' accepts both phase and/or tablename
81-
(via a regular expression) as criteria for deletion of all available
82-
CosmoSim jobs. But be careful: Leaving both arguments blank will
83-
delete ALL jobs!
105+
Additionally, 'check_all_jobs' (and 'delete_all_jobs') accepts both
106+
phase and/or tablename (via a regular expression) as criteria for
107+
deletion of all available CosmoSim jobs. But be careful: Leaving both
108+
arguments blank will delete ALL jobs!
84109

85110
.. code-block:: python
86111
@@ -120,6 +145,22 @@ Deleting all jobs, regardless of tablename, and job phase:
120145
>>> CS.check_all_jobs()
121146
{}
122147
148+
In addition to the phase and regex arguments for 'check_all_jobs',
149+
selected queries can be sorted using two properties:
150+
151+
>>> CS.check_all_jobs(phase=['completed'],regex='[a-z]*[0-9]*',sortby='tablename')
152+
JobID Phase Tablename Starttime
153+
--------------- --------- --------- -------------------------
154+
361298054830707 COMPLETED table1 2014-09-21T19:28:48+02:00
155+
361298050841687 COMPLETED table2 2014-09-21T19:20:23+02:00
156+
157+
>>> CS.check_all_jobs(phase=['completed'],regex='[a-z]*[0-9]*',sortby='starttime')
158+
JobID Phase Tablename Starttime
159+
--------------- --------- --------- -------------------------
160+
361298050841687 COMPLETED table2 2014-09-21T19:20:23+02:00
161+
361298054830707 COMPLETED table1 2014-09-21T19:28:48+02:00
162+
163+
123164
Exploring Database Schema
124165
=========================
125166

0 commit comments

Comments
 (0)