@@ -48,11 +48,6 @@ class BaseSlicer(object):
48
48
saving/restoring metric data should be present (although slicer does not need to be able to
49
49
slice data again and generally will not be able to).
50
50
51
- The sliceMetric has a 'memo-ize' functionality that can save previous indexes & return
52
- metric data value calculated for same set of previous indexes, if desired.
53
- CacheSize = 0 effectively turns this off, otherwise cacheSize should be set by the slicer.
54
- (Most useful for healpix slicer, where many healpixels may have same set of LSST visits).
55
-
56
51
Parameters
57
52
----------
58
53
verbose: boolean, optional
@@ -102,6 +97,13 @@ def setupSlicer(self, simData, maps=None):
102
97
103
98
Set up internal parameters necessary for slicer to slice data and generates indexes on simData.
104
99
Also sets _sliceSimData for a particular slicer.
100
+
101
+ Parameters
102
+ -----------
103
+ simData : np.recarray
104
+ The simulated data to be sliced.
105
+ maps : list of lsst.sims.maf.maps objects, optional.
106
+ Maps to apply at each slicePoint, to add to the slicePoint metadata. Default None.
105
107
"""
106
108
# Typically args will be simData, but opsimFieldSlicer also uses fieldData.
107
109
raise NotImplementedError ()
@@ -169,8 +171,12 @@ def writeData(self, outfilename, metricValues, metricName='',
169
171
"""
170
172
Save metric values along with the information required to re-build the slicer.
171
173
172
- outfilename: the output file
173
- metricValues: the metric values to save to disk
174
+ Parameters
175
+ -----------
176
+ outfilename : str
177
+ The output file name.
178
+ metricValues : np.ma.MaskedArray or np.ndarray
179
+ The metric values to save to disk.
174
180
"""
175
181
header = {}
176
182
header ['metricName' ]= metricName
@@ -210,14 +216,29 @@ def outputJSON(self, metricValues, metricName='',
210
216
"""
211
217
Send metric data to JSON streaming API, along with a little bit of metadata.
212
218
213
- Output is
214
- header dictionary with 'metricName/metadata/simDataName/slicerName' and plot labels from plotDict (if provided).
215
- then data for plot:
216
- if oneDSlicer, it's [ [bin_left_edge, value], [bin_left_edge, value]..].
217
- if a spatial slicer, it's [ [lon, lat, value], [lon, lat, value] ..].
218
-
219
- This method will only work for non-complex metrics (i.e. metrics where the metric value is a float or int),
219
+ This method will only work for metrics where the metricDtype is float or int,
220
220
as JSON will not interpret more complex data properly. These values can't be plotted anyway though.
221
+
222
+ Parameters
223
+ -----------
224
+ metricValues : np.ma.MaskedArray or np.ndarray
225
+ The metric values.
226
+ metricName : str, optional
227
+ The name of the metric. Default ''.
228
+ simDataName : str, optional
229
+ The name of the simulated data source. Default ''.
230
+ metadata : str, optional
231
+ The metadata about this metric. Default ''.
232
+ plotDict : dict, optional.
233
+ The plotDict for this metric bundle. Default None.
234
+
235
+ Returns
236
+ --------
237
+ StringIO
238
+ StringIO object containing a header dictionary with metricName/metadata/simDataName/slicerName,
239
+ and plot labels from plotDict, and metric values/data for plot.
240
+ if oneDSlicer, the data is [ [bin_left_edge, value], [bin_left_edge, value]..].
241
+ if a spatial slicer, the data is [ [lon, lat, value], [lon, lat, value] ..].
221
242
"""
222
243
# Bail if this is not a good data type for JSON.
223
244
if not (metricValues .dtype == 'float' ) or (metricValues .dtype == 'int' ):
@@ -309,7 +330,16 @@ def readData(self, infilename):
309
330
"""
310
331
Read metric data from disk, along with the info to rebuild the slicer (minus new slicing capability).
311
332
312
- infilename: the filename containing the metric data.
333
+ Parameters
334
+ -----------
335
+ infilename: str
336
+ The filename containing the metric data.
337
+
338
+ Returns
339
+ -------
340
+ np.ma.MaskedArray, lsst.sims.maf.slicer, dict
341
+ MetricValues stored in data file, the slicer basis for those metric values, and a dictionary
342
+ containing header information (runName, metadata, etc.).
313
343
"""
314
344
import lsst .sims .maf .slicers as slicers
315
345
restored = np .load (infilename )
0 commit comments