diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a51af --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/.gitignore b/.gitignore index eeb8954..f937fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,12 @@ **/PhotDM.pdf **/PhotDM.fls **/PhotDM.fdb_latexmk + +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build +/.idea/ +/bin/ +/target/ diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..19169b8 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,37 @@ + +plugins { + id("net.ivoa.vo-dml.vodmltools") version "0.5.10" + `maven-publish` + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + signing +} + +group = "org.javastro.ivoa.dm" +version = "1.1-SNAPSHOT" + +vodml { + vodmlDir.set(file("schema")) + bindingFiles.setFrom(file("photdmBinding.xml")) +} + +dependencies { + api("org.javastro.ivoa.vo-dml:ivoa-base:1.0-SNAPSHOT") //reusing the "standard" base library + // Use JUnit Jupiter for testing - only necessary if you want to write unit tests! + implementation("org.slf4j:slf4j-api:1.7.32") + testRuntimeOnly("ch.qos.logback:logback-classic:1.2.3") + testImplementation("org.junit.jupiter:junit-jupiter:5.7.2") + testImplementation("org.javastro:jaxbjpa-utils:0.1.2:test") +} + +tasks.named("test") { + // Use JUnit Platform for unit tests. + useJUnitPlatform() +} +publishing { + publications { + create("maven") { + from(components["java"]) + } + } +} + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..2c35211 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..09523c0 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9d21a21 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/photdmBinding.xml b/photdmBinding.xml new file mode 100644 index 0000000..f8c4469 --- /dev/null +++ b/photdmBinding.xml @@ -0,0 +1,11 @@ + + + + Phot + Photv1-1.vo-dml.xml + org.ivoa.dm.phot + http://ivoa.net/dm/models/vo-dml/xsd/phot + + \ No newline at end of file diff --git a/schema/Photv1-1.vo-dml.xml b/schema/Photv1-1.vo-dml.xml index 6ab463a..32b480c 100644 --- a/schema/Photv1-1.vo-dml.xml +++ b/schema/Photv1-1.vo-dml.xml @@ -14,7 +14,7 @@ Evanthia Hatziminaoglou, Sebastien Derriere, Gerard Lemson 2022-01-06T11:20:20 ivoa - http://www.ivoa.net/xml/VODML/IVOA-v1.vo-dml.xml + IVOA-v1.0.vo-dml.xml https://github.com/ivoa/vo-dml/blob/master/models/ivoa/vo-dml/IVOA-v1.0.html diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..3afd7cc --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ + +rootProject.name = "PhotDM" + +dependencyResolutionManagement { + repositories { + mavenLocal() + mavenCentral() +/* +add this repository to pick up the SNAPSHOT version of the IVOA base library - in the future when this +will not be necessary when this library is released as a non-SNAPSHOT version. + */ + maven { + url= uri("https://oss.sonatype.org/content/repositories/snapshots/") + } + +} +} \ No newline at end of file diff --git a/src/main/vodsl/Photv1-1.vodsl b/src/main/vodsl/Photv1-1.vodsl new file mode 100644 index 0000000..b4759b4 --- /dev/null +++ b/src/main/vodsl/Photv1-1.vodsl @@ -0,0 +1,163 @@ + +model Phot (1.1) "Data model describing Photometric properties for data sets to be used for data calibration, comparison or reprocessing. +" + + author "Jesús Salgado, Carlos Rodrigo, Pedro Osuna, Mark Allen, Mireille Louys, Jonathan McDowell, Deborah Baines, Jesús Maíz Apellániz, +Evanthia Hatziminaoglou, Sebastien Derriere, Gerard Lemson" + primitive UCD "Controlled vocabulary to tag measurements in table columns . See UCD IVOA Recommendation . +" + primitive ISOTime "Time stamp, represented as a string. This representaion is compliant to the DALI time stamp definition : section 3.3.3 Timestamp in +https://www.ivoa.net/documents/DALI/20170517/REC-DALI-1.1.pdf +This class derives from the ivoa:datetime class. + +It could be inserted in the ivoa: template data model for types in a next version. " +enum TypeOfMagSystem "The type of System used to compute magnitude for this photometric calibration procedure ." +{ +VEGAmag "Magnitude system related to VEGA.", +ABmag "AB magnitude system.", +STmag "ST magnitude system." +} + +otype PhotometricSystem "The reference photometric system used to interpret photometric measurements." + { // constraint One association at the time + + description: ivoa:string "This string contains a human readable short-text representation of the photometric system. This will allow client applications to display textual information to final users."; + detectorType: ivoa:integer "Detector type associated to this photometric system. Possible values are: 0 for Energy counter (amplifiers), 1 for Photon counter (CCDs, Photomultipliers)."; + photometryFilter : PhotometryFilter @+ as composition "The Photometric information is related to a Photometric system, and gathers filter descriptions, for one or several . +"; + } + +otype PhotometryFilter "Filter class to store ids, name and properties. +" + { // constraint One association at the time + + fpsidentifier: ivoa:string "IVOA identifier of the filter profile service where this photometry filter is registered to be used in the discovery of all the relevant photometry filter properties."; + identifier: ivoa:string "This field identifies a filter, in a unique way, within a certain Photometry Filter Profile service. +Example to build this string : Facility/Subcategory/Band[/Suffix] like SDSS/SDSS.G/G"; + name: ivoa:string "A human readable string to represent the filter name."; + description: ivoa:string "This string contains a verbose human readable label for the filter. This will allow client applications to display textual information to final users."; + bandname: ivoa:string "A standard label representing the spectral band associated to this filter (if any)."; + dateValidityFrom: ISOTime "Start time of the time coverage for which this filter configuration is applicable. String time format accepted is ISO8601. +"; + dateValidityTo: ISOTime "End time of the time coverage for which this filter configuration is applicable. String time format accepted is ISO8601. +"; + bandwidth : Bandwidth as composition "Association to the spectral band-pass of the Filter. + + +"; + transmissionCurve : TransmissionCurve @? as composition "Link to the Transmission Curve of the Filter, when this is described."; + spectralLocation : SpectralLocation as composition "Association to a spectral coordinate value for locating the Filter band-pass. Usually the mean value. + +"; + } + +otype PhotCal "A class to bind together all photometic calibration reference information: a photometry filter, a certain magnitude system configuration and a certain zero point object." + { // constraint One association at the time + + identifier: ivoa:string "A unique identifier of the Photometry calibration instance within the project and a filterprofile service . Suggested syntax would be: +Facility/Subcategory/Band/Photometric System Type[/Suffix]"; + zeroPoint : ZeroPoint as composition "The ZeroPoint value for the flux to mag translation belongs to a Photcal element and is defined for one Filter element and one MagnitudeSystem ."; + magnitudeSystem : MagnitudeSystem as composition "ZeroPoint values are given with one computation method corresponding to a defined Magnitude system. +"; + photometryFilter references PhotometryFilter "Each PhotCal element is related to one single Filter. Some Filter object may have no calibration registered yet."; + } + +otype ZeroPoint "This class is used to characterize a zero point flux obtained during the calibration of a certain photometry filter on a certain photometric system configuration." + { // constraint One association at the time + + type: ivoa:integer "Type describing the way the zeropoint value is defined . Is an integer value : {0=Pogson, 1=Asinh, 2=Linear} corresponding to zero point definitions."; + referenceMagnitudeValue: ivoa:real "Reference magnitude value of the calibrating object. can be a implemented as a double number to get the maximum precision. +Default value is zero, but sometimes the reference mag measured is slightly above. + +"; + referenceMagnitudeError: ivoa:real "Total error estimated on the reference magnitude value whenever applicable. +"; + flux : Flux as composition "Points to the flux value associated to this ZeroPoint magnitude. +"; + } + +otype PogsonZeropoint -> ZeroPoint "Extension of ZeroPoint to accommodate standard logarithm magnitudes. It has no supplementary attributes but specific conversion functions. +" + { + } + +otype AsinhZeropoint -> ZeroPoint "Extension of ZeroPoint to describe asinh magnitudes, a.k.a. luptitudes." + { + softeningParameter: ivoa:real "Parameter used to correct the calculation of magnitudes for faint sources. Usually called 'b'. See (Lupton and Gunn et al. [1999]) for a formal explanation."; + } + +otype LinearFluxZeropoint -> ZeroPoint "Extension of ZeroPoint to describe simple linear flux photometry, commonly used in Radio, Far Infrared and X-ray spectral ranges. Although not being magnitudes as such, relative linear flux measurements can be included as a special and trivial case of magnitude. +" + { + } + +otype MagnitudeSystem "A class to describe the Magnitude System used , its type and the reference spectrum attached if present." + { + type: TypeOfMagSystem "Type of magnitude system used to compute the associated zeropoint . Typical values are : VEGAmag, ABmag, STmag . +"; + referenceSpectrum: ivoa:anyURI "Link to the reference spectrum as a URI."; + } + +otype Bandwidth "This class is used to characterize the spectral properties of a filter. +" + { // constraint One association at the time + + ucd: UCD "Unified Content Description (UCD) string that specifies the nature of the bandwidth object."; + unitexpression: ivoa:Unit "Unit string that specifies the spectral unit for this filter."; + extent: ivoa:real @? "Bandwidth’s extent of the filter , as length of the covered spectral interval , or effective width following appropriate filter type. +"; + start: ivoa:real "In practice, this could be taken as the minimum value of the filter transmission curve."; + stop: ivoa:real "In practice, this could be taken as the maximum value of the filter transmission curve."; + } + +otype TransmissionPoint "This class is used to represent a point in the transmission function of a Filter. + +" + { // constraint One association at the time + + ucd: UCD "Unified Content Description (UCD) string that specifies the nature of the spectral axis in the transmission curve."; + unit: ivoa:Unit "Unit string that specifies the spectral unit for this filter."; + transmissionValue: ivoa:real "Transmitted value for the filter at this point of the transmission curve. Usually between 0 and 1. +"; + spectralValue: ivoa:real "Spectral coordinate value for the transmission point."; + spectralErrorValue: ivoa:real @? "Error on the spectral coordinate value for the transmission point."; + } + +otype Access "Gathers all properties to access a resource : uri, format and size . +" + { + reference: ivoa:anyURI "URI to access the resource."; + size: ivoa:integer "Approximate estimated size of the dataset, specified in kilobytes."; + format: ivoa:string "Format of the accessed resource. Typically : application/fits, application/x-votable+xml, text/csv, text/xml."; + } + +otype TransmissionCurve "A collection of points along the spectral axis to indicate how flux are transmitted by a filter. +The transmission profile can be described by an external file and accessed through the Access instance, or can be stored as a collection of transmission points stored together in the PhotometryFilter serialized instance." + { + transmissionPoint : TransmissionPoint @+ as composition "Set of points of the transmission curve."; + access : Access @? as composition "Access to an external file containing the set of Transmission Points."; + } + +otype SpectralLocation "A spectral coordinate value for locating the Filter band-pass. Usually the mean value (for instance in wavelength units). +This class is used to characterize the spectral properties of a filter. +" + { // constraint One association at the time + + ucd: UCD "Unified Content Description (UCD) string that specifies the nature of the spectral location for this filter."; + unitexpression: ivoa:Unit "Unit string that specifies the spectral units for this filter."; + value: ivoa:real "A spectral coordinate value that can be considered by the data provider as the most representative for this specific filter bandpass. +In the Optical regime this can represent the effective wavelength, for instance. +"; + } + +otype Flux "This class is used to characterize the photometric calibration Flux<—> Magnitude associated to the ZeroPoint used by a PhotCal instance. +" + { // constraint One association at the time + + ucd: UCD "Unified Content Description (UCD) string that specifies the nature of the flux. +"; + unitexpression: ivoa:Unit "Unit string that specifies the flux unit. +"; + value: ivoa:real "A flux value."; + error: ivoa:real "Flux value error corresponding to the reference magnitude value of the calibrating object. "; + } diff --git a/src/test/java/org/ivoa/dm/phot/examples/PhotModelTest.java b/src/test/java/org/ivoa/dm/phot/examples/PhotModelTest.java new file mode 100644 index 0000000..b432148 --- /dev/null +++ b/src/test/java/org/ivoa/dm/phot/examples/PhotModelTest.java @@ -0,0 +1,129 @@ +/* + * Created on 6 Oct 2022 + * Copyright 2022 Paul Harrison (paul.harrison@manchester.ac.uk) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License in file LICENSE + */ + +package org.ivoa.dm.phot.examples; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.PropertyException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactoryConfigurationError; + +import org.ivoa.dm.ivoa.Unit; +import org.ivoa.dm.phot.Access; +import org.ivoa.dm.phot.Bandwidth; +import org.ivoa.dm.phot.Flux; +import org.ivoa.dm.phot.MagnitudeSystem; +import org.ivoa.dm.phot.PhotCal; +import org.ivoa.dm.phot.PhotModel; +import org.ivoa.dm.phot.PhotometricSystem; +import org.ivoa.dm.phot.PhotometryFilter; +import org.ivoa.dm.phot.SpectralLocation; +import org.ivoa.dm.phot.TransmissionCurve; +import org.ivoa.dm.phot.TypeOfMagSystem; +import org.ivoa.dm.phot.UCD; +import org.ivoa.dm.phot.ZeroPoint; +import org.ivoa.vodml.nav.ModelInstanceTraverser; +import org.javastro.ivoa.tests.AbstractJAXBJPATest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Testing PhotDM . + * recreating https://github.com/ivoa/modelinstanceinvot-code/blob/package/photdm_builder/photdm.WISE.WISE.W1.xml + * @author Paul Harrison (paul.harrison@manchester.ac.uk) + * @since 6 Oct 2022 + */ +class PhotModelTest extends AbstractJAXBJPATest { + + + + private static PhotCal photcal; + private static PhotometricSystem system; + + /** + * + * @throws java.lang.Exception + */ + @BeforeAll + static void setUpBeforeClass() throws Exception { + + PhotometryFilter filter = PhotometryFilter.createPhotometryFilter(f ->{ + f.bandname = ""; + f.name = "WISE W1 filter"; + f.description = "WISE W1 filter"; + f.identifier = "WISE/WISE.W1"; + f.fpsidentifier = "ivo://svo/fps"; + f.bandwidth = Bandwidth.createBandwidth(b->{ + b.ucd = new UCD("instr.bandwidth;stat.fwhm"); + b.unitexpression = new Unit("Angstrom"); + b.extent = 6626.4186524258; + b.start = 27540.970745309; + b.stop = 38723.877229677; + + }); + f.spectralLocation = new SpectralLocation(new UCD("em.wl.effective"), new Unit("Angstrom") , 33526.0); + f.transmissionCurve = TransmissionCurve.createTransmissionCurve(c->{ + c.access = Access.createAccess(a->{ + a.reference = "http://svo2.cab.inta-csic.es/theory/fps/fps.php?PhotCalID=WISE/WISE.W1/Vega"; + a.size = -1; + a.format = "VOTable"; + }); + }); + }); + MagnitudeSystem bb = new MagnitudeSystem(TypeOfMagSystem.VEGAMAG, "http://svo2.cab.inta-csic.es/theory/fps/morefiles/vega.dat"); + photcal = new PhotCal("WISE/WISE.W1/Vega", ZeroPoint.createZeroPoint(z->{ + z.flux = Flux.createFlux(l->{ + l.value = 309.54; + l.ucd = new UCD("phot.flux;meta.modelled"); + l.unitexpression = new Unit("Jy"); + }); + }), bb, filter); + + + + List filters = new ArrayList<>(); + filters.add(filter); + system = new PhotometricSystem("WISE", 0, filters ); + } + + /** + * @throws java.lang.Exception + */ + @BeforeEach + void setUp() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @AfterEach + void tearDown() throws Exception { + } + + @Test + void test() throws PropertyException, TransformerConfigurationException, ParserConfigurationException, JAXBException, TransformerFactoryConfigurationError, TransformerException { + PhotModel model = new PhotModel(); + model.addContent(photcal); + model.addContent(system); + PhotModel modelin = roundtripXML(PhotModel.contextFactory(), model, PhotModel.class); + assertNotNull(modelin); + } + +} + +