Skip to content

Commit 3e5263c

Browse files
committed
update docs
1 parent 5bb3103 commit 3e5263c

File tree

2 files changed

+14
-38
lines changed

2 files changed

+14
-38
lines changed

README.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ this database is writable from the default analysis username/password
6464
6565
import xedocs
6666
67-
db = xedocs.development_db
67+
db = xedocs.development_db()
6868
6969
docs = db.pmt_gains.find_docs(version='v1', pmt=[1,2,3,5], time='2021-01-01T00:00:00', detector='tpc')
7070
gains = [doc.value for doc in docs]
@@ -79,23 +79,20 @@ Read from the straxen processing database, this database is read-only for the de
7979
8080
import xedocs
8181
82-
db = xedocs.straxen_db
82+
db = xedocs.straxen_db()
8383
8484
...
85-
86-
You can also query documents directly from the schema class,
87-
Schemas will query the straxen database by default, if no explicit datasource is given.
85+
86+
Read from the the corrections gitub repository, this database is read-only
87+
8888

8989
.. code-block:: python
9090
91-
from xedocs.schemas import DetectorNumber
91+
import xedocs
9292
93-
drift_velocity = DetectorNumber.straxen_db.find_one(field='drift_velocity', version='v1')
94-
95-
# Returns a Bodega object with attributes value, description etc.
96-
drift_velocity.value
93+
db = xedocs.corrections_repo(branch="master")
9794
98-
all_v1_documents = DetectorNumber.straxen_db.find(version='v1')
95+
...
9996
10097
10198

docs/api_server.rst

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ To use it you will need an http client initializaed with the correction URL and
66

77
.. code-block:: python
88
9-
import rframe
109
import xedocs
1110
12-
datasource = rframe.RestClient(URL, headers={"Authorization": f"Bearer: {ACCESS_TOKEN}"})
11+
db = xedocs.xedocs_api()
1312
14-
gain_docs = xedocs.PmtGains.find(datasource, pmt=1, version='v3')
13+
df = db.posrec_models.find_df(version='v3', run_id=25000)
1514
1615
17-
to make things a bit easier,
18-
there is a utility function that will create an API client for you `xedocs.get_api_client`
16+
there is also a utility function that will create an API client for you `xedocs.get_api_client`
1917
If you dont have a token, it will attempt to use the xeauth package to get one for you (if installed).
2018

2119
You can install xeauth by running `pip install xeauth`
@@ -28,11 +26,6 @@ You can install xeauth by running `pip install xeauth`
2826
2927
# The script will attempt to open a browser for authentication
3028
# if the broswer does not open automatically, follow the link printed out.
31-
# Once you are authenticated as a xenon member, a readonly access token will be
32-
# retrieved automatically. If you change xedocs.settings.API_WRITE to True, a token
33-
# with write permissions will be retrieved.
34-
35-
3629
gain_docs = xedocs.PmtGains.find(datasource, pmt=1, version='v3')
3730
3831
@@ -46,23 +39,9 @@ Example:
4639
4740
import xedocs
4841
49-
doc = xedocs.PmtGains(pmt=1, version='v3', value=1, ...)
50-
doc.save(datasource)
42+
doc = xedocs.PmtAreaToPE(pmt=1, version='v3', value=1, ...)
43+
db.insert(doc)
5144
5245
If all the conditions for insertion are met, e.g. the values for the given index not already being set, the insertion will be successful.
5346

54-
Of course you must have write access to the datasource for any insertion to succeed. The default datasources are all read-only.
55-
When using the server to write values you must request a token with write permissions:
56-
57-
.. code-block:: python
58-
59-
import xedocs
60-
61-
# If you have to correction roles defined (correction expert), you can request a token with
62-
# extended scope i.e. write:all. This token will allow you to write to all correction collections
63-
# If you do not have the proper permissions, you will just get back the default token scope of read:all
64-
datasource = xedocs.get_api_client('pmt_gains')
65-
66-
doc = xedocs.PmtGains(pmt=1, version='v3', value=1, ...)
67-
doc.save(datasource)
68-
47+
Of course you must have write access to the datasource for any insertion to succeed.

0 commit comments

Comments
 (0)