diff --git a/src/firefly/js/templates/lightcurve/LcManager.js b/src/firefly/js/templates/lightcurve/LcManager.js index 03b9a644a6..2a5c409fb0 100644 --- a/src/firefly/js/templates/lightcurve/LcManager.js +++ b/src/firefly/js/templates/lightcurve/LcManager.js @@ -2,21 +2,23 @@ * License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt */ +import {isUndefined, get} from 'lodash'; import {take} from 'redux-saga/effects'; -import {get} from 'lodash'; import {LO_VIEW, LO_MODE, SHOW_DROPDOWN, SET_LAYOUT_MODE, getLayouInfo, dispatchUpdateLayoutInfo, dropDownHandler} from '../../core/LayoutCntlr.js'; import {TBL_RESULTS_ADDED, TABLE_LOADED, TBL_RESULTS_ACTIVE, TABLE_HIGHLIGHT} from '../../tables/TablesCntlr.js'; import {getCellValue, getTblById, makeTblRequest} from '../../tables/TableUtil.js'; import {updateSet} from '../../util/WebUtil.js'; import {dispatchPlotImage} from '../../visualize/ImagePlotCntlr.js'; -import WebPlotRequest from '../../visualize/WebPlotRequest.js'; +import {WebPlotRequest,TitleOptions} from '../../visualize/WebPlotRequest.js'; +import {converters, converterFactory} from '../../metaConvert/ConverterFactory.js'; +import {ServerRequest} from '../../data/ServerRequest.js'; +import {dispatchLoadPlotData} from '../../charts/XYPlotCntlr.js'; export const RAW_TABLE = 'raw_table'; export const PHASE_FOLDED = 'phase_folded'; export const PERIODOGRAM = 'periodogram'; export const PEAK_TABLE = 'peak_table'; - export const IMG_VIEWER_ID = 'lc_image_viewer'; /** @@ -56,6 +58,7 @@ export function* lcManager() { if (newLayoutInfo !== layoutInfo) { dispatchUpdateLayoutInfo(newLayoutInfo); + } } } @@ -94,55 +97,43 @@ function handleTableHighlight(layoutInfo, action) { function getWebPlotRequest(tbl_id) { const tableModel = getTblById(tbl_id); - const ra = getCellValue(tableModel, tableModel.highlightedRow, 'ra'); - const dec = getCellValue(tableModel, tableModel.highlightedRow, 'dec'); - - console.log(`${ra} , ${dec}`); - //Example: frame-id = "02328b152-w1", - // see meaning: http://wise2.ipac.caltech.edu/docs/release/allwise/expsup/sec3_1a.html#frame_id - - const frame_id = getCellValue(tableModel, tableModel.highlightedRow, 'frame_id'); - - var wise_sexp_ibe = /(\d+)([0-9][a-z])(\w+)/g; + const hlrow = tableModel.highlightedRow || 0; + const ra = getCellValue(tableModel, hlrow, 'ra'); + const dec = getCellValue(tableModel, hlrow, 'dec'); + const frameId = getCellValue(tableModel, hlrow, 'frame_id'); + var wise_sexp_ibe = /(\d+)([0-9][a-z])(\w+)/g; + var res = wise_sexp_ibe.exec(frameId); + const scan_id = res[1] + res[2]; + const scangrp = res[2]; + const frame_num = res[3]; - var res = wise_sexp_ibe.exec(frame_id); - /* - will split 'frame_id' into 5 elements array - 02328b152 - full frame-id - 0232 - pre-scanid, (+ scangroup = scan_id) - 8d - scangrp , - 152 - frame_num + const sr= new ServerRequest('ibe_file_retrieve'); + sr.setParam('mission', 'wise'); + sr.setParam('plotId', 'lc_images'); + sr.setParam('PROC_ID', 'ibe_file_retrieve'); + sr.setParam('ProductLevel', '1b'); + sr.setParam('ImageSet', 'allsky-4band'); + sr.setParam('band', 2); + sr.setParam('scangrp', `${scangrp}`); + sr.setParam('scan_id', `${scan_id}`); + sr.setParam('frame_num', `${frame_num}`); + sr.setParam('center', `${ra},${dec}`); + sr.setParam('size', '0.3'); + sr.setParam('subsize', '0.3'); + sr.setParam('in_ra',`${ra}`); + sr.setParam('in_dec',`${dec}`); + + const reqParams = WebPlotRequest.makeProcessorRequest(sr, 'wise'); + reqParams.setTitle('WISE-'+ frameId); +// reqParams.setInitialZoomLevel(0.5); + return reqParams; - see http://irsa.ipac.caltech.edu/ibe/docs/wise/merge/merge_p1bm_frm/#int - IBE url: - http://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/{scangrp:s}/{scan_id:s}/{frame_num:03d}/{scan_id:s}{frame_num:03d}-w{band:1d}-int-1b.fits - */ - const scan_id = res[1]+res[2]; - const scangrp = res[2]; - const frame_num = res[3]; - console.log(`http://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/${scangrp}/${scan_id}/${frame_num}/${scan_id}${frame_num}-w1-int-1b.fits`); - // return makeWebPlotRequest(tbl_id); should use the commented code below to retrieve wise images. - // this is just a placeholder. - //return { - // plotId: 'lc_images', - // Type : 'SERVICE', - // Service : 'WISE', - // Title : 'Wise', - // SurveyKey : 'Atlas', - // SurveyKeyBand : '2', - // WorldPt : `${ra};${dec};EQ_J2000`, - // SizeInDeg : '.3', - // AllowImageSelection : true - //}; - - const url = `http://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/${scangrp}/${scan_id}/${frame_num}/${scan_id}${frame_num}-w1-int-1b.fits`; - var wpr = WebPlotRequest.makeURLPlotRequest(url); - return wpr; } -function makeWebPlotRequest() { +function makeWebPlotRequest(tbl_id) { +//todo make grid plotting with hlrow+1, hlrow, hlrow-1 // for WISE, should convert gwt code from here: edu.caltech.ipac.hydra.server.query.WiseGrid.makeRequest; } diff --git a/src/firefly/js/templates/lightcurve/LcPhaseFoldingPanel.jsx b/src/firefly/js/templates/lightcurve/LcPhaseFoldingPanel.jsx index 21c752e64e..a1df7454c4 100644 --- a/src/firefly/js/templates/lightcurve/LcPhaseFoldingPanel.jsx +++ b/src/firefly/js/templates/lightcurve/LcPhaseFoldingPanel.jsx @@ -26,6 +26,9 @@ import {Tabs, Tab,FieldGroupTabs} from '../../ui/panel/TabPanel.jsx'; import {dispatchShowDialog} from '../../core/ComponentCntlr.js'; import {dispatchTableSearch} from '../../tables/TablesCntlr.js'; +import {dispatchLoadPlotData} from '../../charts/XYPlotCntlr.js'; + + import {RAW_TABLE, PHASE_FOLDED} from '../../templates/lightcurve/LcManager.js'; function getDialogBuilder() { @@ -387,6 +390,8 @@ function doPhaseFolding(fields) { }, {tbl_id:PHASE_FOLDED}); if (tReq !== null) { dispatchTableSearch(tReq, {removable: false}); + let xyPlotParams = {x: {columnOrExpr: 'phase', options: 'grid'}, y: {columnOrExpr: 'w1mpro_ep', options:'grid'}}; + dispatchLoadPlotData({chartId:PHASE_FOLDED, tblId:PHASE_FOLDED, markAsDefault:true, xyPlotParams}); } } diff --git a/src/firefly/js/templates/lightcurve/LcResult.jsx b/src/firefly/js/templates/lightcurve/LcResult.jsx index d4dca0ac3a..079cbdb97f 100644 --- a/src/firefly/js/templates/lightcurve/LcResult.jsx +++ b/src/firefly/js/templates/lightcurve/LcResult.jsx @@ -102,7 +102,7 @@ export class LcResult extends Component { {LcPFOptionsPanel(fields)} - +
diff --git a/src/firefly/js/templates/lightcurve/LcViewer.jsx b/src/firefly/js/templates/lightcurve/LcViewer.jsx index 03712769ed..c136689162 100644 --- a/src/firefly/js/templates/lightcurve/LcViewer.jsx +++ b/src/firefly/js/templates/lightcurve/LcViewer.jsx @@ -215,10 +215,10 @@ function onSearchSubmit(request) { xyPlotParams = {x: {columnOrExpr: 'mjd'}, y: {columnOrExpr: 'w1mpro_ep'}}; } else if ( get(request, PHASE_FOLDED) ) { treq = TblUtil.makeFileRequest('Phase Folded', request[PHASE_FOLDED], null, {tbl_id:PHASE_FOLDED}); - xyPlotParams = {x: {columnOrExpr: 'mjd'}, y: {columnOrExpr: 'w2mpro_ep'}}; + xyPlotParams = {x: {columnOrExpr: 'phase'}, y: {columnOrExpr: 'w1mpro_ep'}}; } else if ( get(request, PERIODOGRAM) ) { treq = TblUtil.makeFileRequest('Periodogram', request[PERIODOGRAM], null, {tbl_id:PERIODOGRAM}); - xyPlotParams = {x: {columnOrExpr: 'log(PERIOD)'}, y: {columnOrExpr: 'POWER'}}; + xyPlotParams = {x: {columnOrExpr: 'PERIOD', options: 'log'}, y: {columnOrExpr: 'POWER'}}; } else if ( get(request, PEAK_TABLE) ) { treq = TblUtil.makeFileRequest('Peak Table', request[PEAK_TABLE], null, {tbl_id:PEAK_TABLE}); } diff --git a/src/firefly/js/templates/lightcurve/PeriodogramOptionsPanel.jsx b/src/firefly/js/templates/lightcurve/PeriodogramOptionsPanel.jsx index b3f6a4d1c7..86b43d200b 100644 --- a/src/firefly/js/templates/lightcurve/PeriodogramOptionsPanel.jsx +++ b/src/firefly/js/templates/lightcurve/PeriodogramOptionsPanel.jsx @@ -17,6 +17,9 @@ import {FieldGroupCollapsible} from '../../ui/panel/CollapsiblePanel.jsx'; import Validate from '../../util/Validate.js'; import {ValidationField} from '../../ui/ValidationField.jsx'; import {makeTblRequest,getTblById} from '../../tables/TableUtil.js'; + +import {dispatchLoadPlotData} from '../../charts/XYPlotCntlr.js'; + import {RAW_TABLE,PERIODOGRAM, PEAK_TABLE} from '../../templates/lightcurve/LcManager.js'; const gkey = 'PFO_PANEL'; @@ -192,22 +195,33 @@ function doPeriodFinding(request) { //let tbl = getTblById(RAW_TABLE); console.log(request); - var tReq = makeTblRequest('LightCurveProcessor',PERIODOGRAM , { - 'result_table': 'http://web.ipac.caltech.edu/staff/ejoliet/demo/vo-nexsci-result-sample.xml', //For now return result table for non-existing API - 'table_name': PERIODOGRAM - }, {tbl_id:PERIODOGRAM}); - - if (tReq != null) { - dispatchTableSearch(tReq, {removable: false}); - } - var tReq2 = makeTblRequest('LightCurveProcessor',PEAK_TABLE , { 'result_table': 'http://web.ipac.caltech.edu/staff/ejoliet/demo/vo-nexsci-result-sample.xml', //For now return result table for non-existing API 'table_name': PEAK_TABLE }, {tbl_id:PEAK_TABLE}); if (tReq2 != null) { - dispatchTableSearch(tReq2, {removable: false}); + let xyPlotParams = { + x: {columnOrExpr: 'Peak', options: 'grid'}, + y: {columnOrExpr: 'Power', options: 'grid'} + }; + dispatchLoadPlotData({chartId:PEAK_TABLE, tblId:PEAK_TABLE, markAsDefault:true, xyPlotParams}); + dispatchTableSearch(tReq2, {removable: true}); + } + + var tReq = makeTblRequest('LightCurveProcessor',PERIODOGRAM , { + 'result_table': 'http://web.ipac.caltech.edu/staff/ejoliet/demo/vo-nexsci-result-sample.xml', //For now return result table for non-existing API + 'table_name': PERIODOGRAM + }, {tbl_id:PERIODOGRAM}); + + if (tReq != null) { + dispatchTableSearch(tReq, {removable: true}); + let xyPlotParams = { + userSetBoundaries: {yMin: 0}, + x: {columnOrExpr: 'PERIOD', options: 'grid, log'}, + y: {columnOrExpr: 'POWER', options: 'grid'} + }; + dispatchLoadPlotData({chartId:PERIODOGRAM, tblId:PERIODOGRAM, markAsDefault:true, xyPlotParams}); } } diff --git a/src/firefly/js/visualize/WebPlotRequest.js b/src/firefly/js/visualize/WebPlotRequest.js index 8953f1baea..fe4ae8aef5 100644 --- a/src/firefly/js/visualize/WebPlotRequest.js +++ b/src/firefly/js/visualize/WebPlotRequest.js @@ -269,9 +269,10 @@ export class WebPlotRequest extends ServerRequest { return req; } - static makeProcessorRequest(obj, desc) { + static makeProcessorRequest(serverRequest, desc) { var req = new WebPlotRequest(RequestType.PROCESSOR, desc); - req.setParams(obj); + // req.setParams(serverRequest.getParams()); + req.setParams(serverRequest.getParams()); return req; } @@ -333,7 +334,7 @@ export class WebPlotRequest extends ServerRequest { /** * - * @param worldPt + * @param wp * @param {string} survey must be one of 'j','h','k' * @param sizeInDeg less then .138 degreess (500 arcsec) * @return {WebPlotRequest} @@ -703,7 +704,7 @@ export class WebPlotRequest extends ServerRequest { /** * Plot should come up rotated north * - * @param {boolean} rotateNorth, true to rotate + * @param {boolean} rotateNorth true to rotate */ setRotateNorth(rotateNorth) { this.setParam(C.ROTATE_NORTH, rotateNorth + ''); } @@ -996,7 +997,8 @@ export class WebPlotRequest extends ServerRequest { //====================================================================== /** - * @return objectName, string, astronomical object to search + * @return objectName string astronomical object to search + * @param objectName */ setObjectName(objectName) { this.setParam(C.OBJECT_NAME, objectName); }