AAVSO / VStar

VStar is a visualisation and analysis tool for variable star data brought to you by AAVSO
https://www.aavso.org/vstar
GNU Affero General Public License v3.0
10 stars 3 forks source link

Observation details are always strings #325

Closed mpyat2 closed 1 year ago

mpyat2 commented 1 year ago

It is possible to add an observation detail (via ob.addDetail(key, ...)) as a string only. However, to be properly used in VeLa filters, numeric details (flux, RA, Dec, etc.) should be of numeric type.

dbenn commented 1 year ago

Now thinking about this one after addressing #324

dbenn commented 1 year ago

My current thinking is to create a class for use by ValidObservation that handles typed details via overloaded methods and delegation to the appropriate internal data caches, also recording a mapping from name to type to assist with this.

mpyat2 commented 1 year ago

It can be something like to Windows VARIANT structure (https://learn.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant) that is the basis of Visual Basic / VBA Variant type (there is also a multiplatform implementation of similar Variant type in FreePascal https://wiki.freepascal.org/Variant ). I believe we do not need so many different types, probably String, int (or long), and float would be enough.

dbenn commented 1 year ago

Agreed, and also Boolean.

This is essentially what VeLa's Operand class does.

dbenn commented 1 year ago

For ValidObservation details

or use Operand or a simpler variant type internally.

dbenn commented 1 year ago

@mpyat2: Now that details can be types other than strings, and I have changed the DASCH plugin's flags detail to be integer, other plugins may need to be changed as well to take advantage of this:

find plugin/src -name "*.java" -exec grep -l "addDetail" {} \;

plugin/src/org/aavso/tools/vstar/external/plugin/HipparcosObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/ASASSNObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/KeplerFITSObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/CatalinaSkySurveyObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/QLPFITSObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/SuperWASPFITSObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/VSOLJObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/ASASObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/NSVSObservationSource.java
plugin/src/org/aavso/tools/vstar/external/plugin/DASCHObservationSource.java

with DASCHObservationSource.java already having been modified.

HipparcosObservationSource.java has a flags detail but I think the values are named flags.

ASASSNObservationSource.java has:

observation.addDetail("FWHM", fields[3], "FWHM");
observation.addDetail("LIMIT", fields[4], "Limit");
observation.addDetail("FLUX", fields[7], "Flux (mJy)");
observation.addDetail("FLUX_ERR", fields[8], "Flux error");

that have been changed to double now.

KeplerFITSObservationSource.java and QLPFITSObservationSource.java has HEAGER_MAG (HEA**D**ER vs HEA**G**ER?) and QUALITY (TODO)

CatalinaSkySurveyObservationSource.java RA, Dec, Blend details have changed to be numeric.

SuperWASPFITSObservationSource.java: changed CCD,XY and flux details to double.

VSOLJObservationSource.java unchanged since no numeric details.

ASASObservationSource.java unchanged since no numeric details.

NSVSObservationSource.java has a flags detail that we could change to integer it would seem. Is NSVS still serving up data though? The default search doesn't behave as per the plugin documentation with respect to search results.