ratt-ru / dask-ms

Implementation of a dask/xarray dataset backed by a CASA MS
https://dask-ms.readthedocs.io
Other
19 stars 7 forks source link

Data Column Expressions #124

Closed sjperkins closed 4 years ago

sjperkins commented 4 years ago
sjperkins commented 4 years ago

@o-smirnov @bennahugo @IanHeywood @JSKenyon @smasoka @rubyvanrooyen

Primarily with https://github.com/ska-sa/tricolour/issues/70 in mind but might be useful elsewhere:

Code snippet:

datasets = xds_from_ms("WSRT.MS")
datasets = data_column_expr("2 * DATA / (DIR1_DATA + DIR2_DATA)", datasets)
consume(datasets[0].DATA_EXPRESSION.data)
sjperkins commented 4 years ago

and @landmanbester of course

sjperkins commented 4 years ago

Changed to support assignments:

datasets = xds_from_ms("WSRT.MS")
datasets = data_column_expr("EXPR = 2 * DATA / (DIR1_DATA + DIR2_DATA)", datasets)
consume(datasets[0].EXPR.data)
o-smirnov commented 4 years ago

This is an absolutely awesome change, much more powerful than my simple binary arithmetic. I look forward to supporting this in shadeMS!

sjperkins commented 4 years ago

It supports a simple calculator syntax at the moment (no functions), but it could always be expanded later.

sjperkins commented 4 years ago

OK this is percolating in master if people wish to try it out. I've also exposed the docstrings on readthedocs.io