Skip to content

Commit 3bfef66

Browse files
committed
BUG: fixing referencing syntax
1 parent 193809b commit 3bfef66

File tree

2 files changed

+67
-65
lines changed

2 files changed

+67
-65
lines changed

docs/mivot/annoter.rst

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _mivot-annoter:
2+
13
******************************************************
24
MIVOT (``pyvo.mivot``): Annotation Writer - Public API
35
******************************************************
@@ -11,7 +13,7 @@ Mango objects are made of a property container, a description of the data origin
1113
on other Mango objects (not implemented yet).
1214

1315
In this current implementation, only 3 properties are supported (Epoch position, photometry, and color)
14-
in addition to the data origin that can be added as literal values (not connected with table data).
16+
in addition to the data origin that can be added as literal values (not connected with table data).
1517

1618
The pseudo codes below show the way to use this API.
1719

@@ -27,26 +29,26 @@ The ``dmid`` optional parameter gives the column (ID or name) to be used as iden
2729
The builder is then ready to get the properties to add to the Mango object.
2830

2931
.. code-block:: python
30-
32+
3133
builder.add_mango_magnitude(photcal_id=photcal_id, mapping=mapping, semantics=semantics)
3234
builder.add_mango_magnitude(photcal_id=other_photcal_id, mapping=other_mapping, semantics=other_semantics)
3335
builder.add_mango_color(filter_ids=filter_ids, mapping=mapping, semantics=semantics)
3436
builder.add_mango_epoch_position(frames=frames, mapping=mapping, semantics=semantics)
3537
36-
We can now add the description of the data origin.
38+
We can now add the description of the data origin.
3739

3840
.. code-block:: python
39-
41+
4042
builder.add_query_origin(mapping)
41-
43+
4244
- The order in which the components are added does not matter.
4345
- The details of the parameters are described below.
4446

4547
Now the MIVOT block can be completed and inserted into the VOtable.
4648

4749

4850
.. code-block:: python
49-
51+
5052
builder.pack_into_votable()
5153
votable.to_xml("MY/ANNOTATED/VOTABLE")
5254
@@ -61,37 +63,37 @@ The lists of supported roles are given in the :py:mod:`pyvo.mivot.glossary`.
6163
The 3 functions adding properties have all 3 arguments
6264

6365
- ``filter/frame``: Map of the coordinate systems or photometric calibrations that apply to the property.
64-
All values specified here are considered literal.
66+
All values specified here are considered literal.
6567
The corresponding Mivot instances are placed in the GLOBALS block.
66-
68+
6769
- **Photometric filter**: must be given as a filter profile service identifier (filter id followed with the photometric system)
68-
70+
6971
- Identifiers can be found on the SVO `page <http://svo2.cab.inta-csic.es/theory/fps/>`_
70-
(example: ``GAIA/GAIA3.Grp/AB``)
71-
- The FPS service returns a full calibration instance, which is then split into a filter object
72+
(example: ``GAIA/GAIA3.Grp/AB``)
73+
- The FPS service returns a full calibration instance, which is then split into a filter object
7274
and a calibration object that refers to that filter.
7375
- Each one of these components has its own ``dmid`` generated by the API. ``dmid`` can be used to reference them.
74-
Example for filter ``GAIA/GAIA3.Grp/AB``:
75-
76+
Example for filter ``GAIA/GAIA3.Grp/AB``:
77+
7678
- photometric calibration identifer: ``dmid="_photcal_GAIA_GAIA3_Grvs_AB"``
77-
- filter identifier ``dmid="_filter_GAIA_GAIA3_Grvs_AB"``
78-
79+
- filter identifier ``dmid="_filter_GAIA_GAIA3_Grvs_AB"``
80+
7981
- **Coordinate systems**: Can be given either by ``dmid`` or by parameters
80-
(see `pyvo.mivot.writer.InstancesFromModels.add_simple_space_frame`
82+
(see `pyvo.mivot.writer.InstancesFromModels.add_simple_space_frame`
8183
and `pyvo.mivot.writer.InstancesFromModels.add_simple_time_frame`).
8284

83-
- by ``dmid``: Identifiers are generated by the API when a frame is added in the GLOBALS.
85+
- by ``dmid``: Identifiers are generated by the API when a frame is added in the GLOBALS.
8486
(example ``{"dmid": "_spaceframe_spaceRefFrame_equinox_refPosition"}``)
8587
- by parameters: The mapping parameters are given as dictionaries as for the mapping (see below)
8688
(example ``{"spaceRefFrame": "ICRS", "refPosition": 'BARYCENTER'}``)
8789

88-
- ``Mapping``: Mapping of the table data to the property attributes.
90+
- ``Mapping``: Mapping of the table data to the property attributes.
8991
The fine structure of these dictionaries is specific to each mapped class,
9092
but all follow the same pattern.
9193
Values specified as strings are considered to be column identifiers,
9294
unless the string starts with a '*'. In this case, the stripped string is taken as the literal value.
93-
Other value types (numeric or boolean) are all considered as literals.
94-
95+
Other value types (numeric or boolean) are all considered as literals.
96+
9597
+-------------+---------------------------------+
9698
| **value** | **attribute value** |
9799
+=============+=================================+
@@ -107,7 +109,7 @@ The 3 functions adding properties have all 3 arguments
107109
+-------------+---------------------------------+
108110

109111
- ``semantics``: Semantic tags (text + vocabulary entry) that apply to the property.
110-
112+
111113
+-------------+---------------------------------------------------------+
112114
+ **key** | **value** +
113115
+=============+=========================================================+
@@ -118,7 +120,7 @@ The 3 functions adding properties have all 3 arguments
118120
+ label + vocabulary term to which the property refers +
119121
+-------------+---------------------------------------------------------+
120122

121-
All ``semantics`` fields are considered literal values.
123+
All ``semantics`` fields are considered literal values.
122124

123125
Add Query origin
124126
----------------
@@ -127,7 +129,7 @@ Add the Mango ``QueryOrigin`` instance to the current ``MangoObject``.
127129

128130
.. figure:: _images/mangoDataOrigin.png
129131
:width: 500
130-
132+
131133
DataOrigin package of Mango.
132134

133135

@@ -142,7 +144,7 @@ of the MangoObject. It is always identified with ``dmid="_origin"``
142144
The detail of the ``mapping`` parameter is given in the `pyvo.mivot.writer.InstancesFromModels.add_query_origin` documentation
143145

144146
The ``QueryOrigin`` object can be automatically built from the INFO tags of the VOtable. The success of this operation depends
145-
on the way INFO tags are populated.
147+
on the way INFO tags are populated.
146148

147149
The method below, analyzes the INFO tags and insert the resulting query origin into the annotations.
148150

@@ -155,20 +157,20 @@ The method below, analyzes the INFO tags and insert the resulting query origin i
155157
- INFO tags of the header of the first resource are analyzed to set the ``DataOrigin`` objects.
156158
- The automatic mapping does not work for VOtable joining several tables yet.
157159

158-
160+
159161
Add Properties
160162
--------------
161163

162164
The main purpose of the ``MangoObject`` is to collect various properties contained in the data row,
163165
although synthetic properties (literal value only) can be added as well.
164166

165-
- The properties are stored in a container named ``propertyDock``.
166-
- During he annotation process, properties are added one by one by specific methods.
167+
- The properties are stored in a container named ``propertyDock``.
168+
- During he annotation process, properties are added one by one by specific methods.
167169

168170
.. figure:: _images/mangoProperties.png
169171
:width: 500
170-
171-
172+
173+
172174
Properties supported by Mango.
173175

174176
Add EpochPosition
@@ -178,8 +180,8 @@ The ``EpochPosition`` property describes the astrometry of a moving source.
178180

179181
.. figure:: _images/mangoEpochPosition.png
180182
:width: 500
181-
182-
183+
184+
183185
EpochPosition components of Mango.
184186

185187
It handles six parameters (position, proper motion, parallax and radial velocity) valid at a given epoch
@@ -189,7 +191,7 @@ It handles six parameters (position, proper motion, parallax and radial velocity
189191
190192
builder.add_epoch_position(frames, mapping, semantics)
191193
192-
The detail of the parameters is given with the description of the
194+
The detail of the parameters is given with the description of the
193195
:py:meth:`pyvo.mivot.writer.InstancesFromModels.add_mango_epoch_position` method.
194196

195197
The first parameter (``frames``) specifies both space and time frames.
@@ -226,7 +228,7 @@ The ``Brightness`` binds a flux or a magnitude with an error and a photometric c
226228
227229
builder.add_mango_brightness(photcal_id, mapping, semantics)
228230
229-
The detail of the parameters is given with the
231+
The detail of the parameters is given with the
230232
:py:meth:`pyvo.mivot.writer.InstancesFromModels.add_mango_brightness` docstring.
231233

232234
Add Color
@@ -238,7 +240,7 @@ The ``Color`` binds to a Color index or an hardness ratio value with an error an
238240
239241
builder.add_mango_color(filter_ids, mapping, semantics)
240242
241-
The detail of the parameters is given with the
243+
The detail of the parameters is given with the
242244
:py:meth:`pyvo.mivot.writer.InstancesFromModels.add_mango_color` docstring.
243245

244246

docs/mivot/example.rst

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Photometric properties readout
77

88
This example is based on VOTables provided by the ``XTapDB`` service.
99
This service exposes the slim `4XMM dr14 catalogue <http://xmmssc.irap.omp.eu/>`_.
10-
It is able to map query responses on the fly to the MANGO data model.
10+
It is able to map query responses on the fly to the MANGO data model.
1111
The annotation process only annotates the columns that are selected by the query.
1212

1313
The following properties are supported:
@@ -23,32 +23,32 @@ to tell the server to annotate the queried data.
2323
(*Please read the comment inside the code snippet carefully to fully understand the process*)
2424

2525
.. code-block:: python
26-
26+
2727
import pytest
2828
from pyvo.utils import activate_features
2929
from pyvo.dal import TAPService
3030
from pyvo.mivot.utils.xml_utils import XmlUtils
3131
from pyvo.mivot.utils.dict_utils import DictUtils
3232
from pyvo.mivot.viewer.mivot_viewer import MivotViewer
33-
33+
3434
# Enable MIVOT-specific features in the pyvo library
3535
activate_features("MIVOT")
36-
36+
3737
service = TAPService('https://xcatdb.unistra.fr/xtapdb')
3838
result = service.run_sync(
3939
"""
40-
SELECT TOP 5 * FROM "public".mergedentry
40+
SELECT TOP 5 * FROM "public".mergedentry
4141
""",
4242
format="application/x-votable+xml;content=mivot"
4343
)
44-
44+
4545
# The MIVOT viewer generates the model view of the data
46-
m_viewer = MivotViewer(result, resolve_ref=True)
47-
46+
m_viewer = MivotViewer(result, resolve_ref=True)
47+
4848
# Print out the Mivot annotations read out of the VOtable
4949
# This statement is just for a pedagogic purpose (access to a private attribute)
5050
XmlUtils.pretty_print(m_viewer._mapping_block)
51-
51+
5252
5353
In this first step we just queried the service and we built the object that will process the Mivot annotations.
5454
The Mivot block printing output is too long to be listed here. However, the screenshot below shows its shallow structure.
@@ -61,13 +61,13 @@ The Mivot block printing output is too long to be listed here. However, the scre
6161
the detection flags and the photometric calibrations.
6262
- The TEMPLATES section contains the objects to which table data is mapped. In this example, there is one
6363
``MangoObject`` instance which holds all the mapped properties.
64-
64+
6565
At instantiation time, the viewer reads the first data row, which must exist,
66-
in order to construct a Python object that reflects the mapped model.
66+
in order to construct a Python object that reflects the mapped model.
6767

6868
.. code-block:: python
69-
70-
# Build a Python object matching the TEMPLATES content and
69+
70+
# Build a Python object matching the TEMPLATES content and
7171
# which leaves are set with the values of the first row
7272
mango_object = m_viewer.dm_instance
7373
@@ -107,12 +107,12 @@ Now, we can iterate through the table data and retrieve an updated Mivot instanc
107107
...
108108
109109
The same code can easily be connected with matplotlib to plot SEDs as shown below (code not provided).
110-
110+
111111

112112
.. image:: _images/xtapdbSED.png
113113
:width: 500
114114
:alt: XMM SED
115-
115+
116116
It is to noted that the current table row keeps available through the Mivot viewer.
117117

118118
.. code-block:: python
@@ -133,23 +133,23 @@ EpochPosition property readout
133133
==============================
134134

135135
This example is based on a VOtable resulting on a Vizier cone search.
136-
This service maps the data to the ``EpochPosition`` MANGO property,
136+
This service maps the data to the ``EpochPosition`` MANGO property,
137137
which models a full source's astrometry at a given date.
138138

139139

140140
.. warning::
141141
At the time of writing, Vizier only mapped positions and proper motions (when available),
142142
and the definitive epoch class had not been adopted.
143143
Therefore, this implementation may differ a little bit from the standard model.
144-
144+
145145
Vizier does not wrap the source properties in a MANGO object,
146-
but rather lists them in the Mivot *TEMPLATES*.
146+
but rather lists them in the Mivot *TEMPLATES*.
147147
The annotation reader must support both designs.
148148

149149
In the first step below, we run a standard cone search query by using the standard PyVO API.
150150

151151
.. code-block:: python
152-
152+
153153
import pytest
154154
import astropy.units as u
155155
from astropy.coordinates import SkyCoord
@@ -162,7 +162,7 @@ In the first step below, we run a standard cone search query by using the standa
162162
163163
# Enable MIVOT-specific features in the pyvo library
164164
activate_features("MIVOT")
165-
165+
166166
scs_srv = SCSService("https://vizier.cds.unistra.fr/viz-bin/conesearch/V1.5/I/239/hip_main")
167167
168168
query_result = scs_srv.search(
@@ -175,8 +175,8 @@ In the first step below, we run a standard cone search query by using the standa
175175
Once the query is finished, we can get a reference to the object that will process the Mivot annotations.
176176

177177
.. code-block:: python
178-
179-
# Build a Python object matching the TEMPLATES content and
178+
179+
# Build a Python object matching the TEMPLATES content and
180180
# which leaves are set with the values of the first row
181181
mango_property = m_viewer.dm_instance
182182
@@ -188,7 +188,7 @@ The annotations are consumed by this dynamic Python object which leaves are set
188188
You can explore the structure of this object by using standard object paths or by browsing the dictionary shown below.
189189

190190
.. code-block:: json
191-
191+
192192
{
193193
"dmtype": "mango:EpochPosition",
194194
"longitude": {
@@ -234,14 +234,14 @@ You can explore the structure of this object by using standard object paths or b
234234
}
235235
}
236236
}
237-
}
237+
}
238+
238239

239-
240240
The reader can transform ``EpochPosition`` instances into ``SkyCoord`` instances.
241241
These can then be used for further scientific processing.
242-
242+
243243
.. code-block:: python
244-
244+
245245
while m_viewer.next_row_view():
246246
if mango_property.dmtype == "mango:EpochPosition":
247247
scb = SkyCoordBuilder(mango_property.to_dict())
@@ -251,9 +251,9 @@ You can explore the structure of this object by using standard object paths or b
251251
.. important::
252252
Similar to the previous example, this code can be used with any VOTable with data mapped to MANGO.
253253
It contains no features specific to the Vizier output.
254-
254+
255255
It avoids the need for users to build SkyCoord objects by hand from VOTable fields,
256256
which is never an easy task.
257-
258-
259-
The next section provides some tips to use the API documented in the annoter `page <annoter.html>`_.
257+
258+
259+
The next section provides some tips to use the API documented in the :ref:`annoter page <mivot-annoter>`.

0 commit comments

Comments
 (0)