Skip to content

Commit bdf1a72

Browse files
committed
Merge branch 'rc' into dev
2 parents 1889e98 + 36d4e32 commit bdf1a72

File tree

7 files changed

+63
-27
lines changed

7 files changed

+63
-27
lines changed

src/firefly/java/edu/caltech/ipac/util/IpacTableUtil.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,15 @@ public static void setDataNullStr(List<DataType> cols, String line) {
174174
}
175175
}
176176
public static void guessFormatInfo(DataType dataType, String value) {
177+
guessFormatInfo(dataType, value, 0);
178+
}
179+
180+
public static void guessFormatInfo(DataType dataType, String value, int precision) {
177181

178-
String formatStr = guessFormatStr(dataType, value.trim());
182+
String formatStr = guessFormatStr(dataType, value.trim(), precision);
179183
if (formatStr != null) {
180184
DataType.FormatInfo.Align align = value.startsWith(" ") ? DataType.FormatInfo.Align.RIGHT
181-
: DataType.FormatInfo.Align.LEFT;
185+
: DataType.FormatInfo.Align.LEFT;
182186
DataType.FormatInfo fi = dataType.getFormatInfo();
183187
fi.setDataFormat(formatStr);
184188
fi.setDataAlign(align);
@@ -405,16 +409,16 @@ private static TableDef doGetMetaInfo(BufferedReader reader, File src) throws IO
405409
return meta;
406410
}
407411

408-
public static String guessFormatStr(DataType type, String val) {
412+
public static String guessFormatStr(DataType type, String val, int precision) {
409413
if (type.getTypeDesc() != null &&
410414
ServerStringUtil.matchesRegExpList(type.getTypeDesc(), STRING_TYPE, true)) {
411415
return "%s";
412416
} else {
413-
return guessFormatStr(val, type.getDataType());
417+
return guessFormatStr(val, type.getDataType(), precision);
414418
}
415419
}
416420

417-
private static String guessFormatStr(String val, Class cls) {
421+
private static String guessFormatStr(String val, Class cls, int minPrecision) {
418422

419423
String formatStr = null;
420424
try {
@@ -436,7 +440,7 @@ private static String guessFormatStr(String val, Class cls) {
436440
// decimal format
437441
int idx = val.indexOf(".");
438442
int prec = val.length() - idx - 1;
439-
return "%." + prec + "f";
443+
return "%." + Math.max(prec,minPrecision) + "f";
440444
} else {
441445
boolean isFloat= (cls==Float.class || cls==Double.class);
442446
formatStr = isFloat ? "%.0f" : "%d";

src/firefly/java/edu/caltech/ipac/util/VoTableUtil.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import edu.caltech.ipac.astro.IpacTableWriter;
77
import uk.ac.starlink.table.*;
88
import uk.ac.starlink.util.DataSource;
9+
import uk.ac.starlink.votable.VOStarTable;
910
import uk.ac.starlink.votable.VOTableBuilder;
1011

1112
import java.io.File;
@@ -48,8 +49,17 @@ private static DataGroup convertToDataGroup(StarTable table, boolean headerOnly)
4849
String title = table.getName();
4950
List<DataType> cols = new ArrayList<DataType>();
5051
String raCol=null, decCol=null;
52+
int precision = 8;
5153
for (int i = 0; i < table.getColumnCount(); i++) {
5254
ColumnInfo cinfo = table.getColumnInfo(i);
55+
if(cinfo.getAuxDatum(VOStarTable.PRECISION_INFO)!=null){
56+
try{
57+
precision = Integer.parseInt(cinfo.getAuxDatum(VOStarTable.PRECISION_INFO).toString());
58+
}catch (NumberFormatException e){
59+
// problem with VOTable vinfo precision: should be numeric - keep default min precision
60+
continue;
61+
}
62+
}
5363
DataType dt = new DataType(cinfo.getName(), cinfo.getName(),
5464
cinfo.isArray() ? String.class : cinfo.getContentClass(),
5565
null, cinfo.getUnitString(), false); // mayBeNull is false to use empty space instead of null
@@ -97,7 +107,7 @@ private static DataGroup convertToDataGroup(StarTable table, boolean headerOnly)
97107
row.setDataElement(dtype, val);
98108
}
99109
if (dtype.getFormatInfo().isDefault()) {
100-
IpacTableUtil.guessFormatInfo(dtype, sval);
110+
IpacTableUtil.guessFormatInfo(dtype, sval, precision);// precision min 8 can come from VOTable attribute 'precision' later on.
101111
}
102112
if (sval != null && sval.length() > dtype.getMaxDataWidth()) {
103113
dtype.setMaxDataWidth(sval.length());

src/firefly/js/tables/ui/FilterEditor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function makeCallbacks(onChange, columns, data, orgFilterInfo='') {
134134
var onRowSelect = (checked, rowIdx) => {
135135
const selColName = get(data, [rowIdx, 0]);
136136
const nColumns = cloneDeep(columns);
137-
const selCol = nColumns.find((col) => col.name === selColName);
137+
const selCol = nColumns.find((col) => col.name === selColName || col.label === selColName);
138138
selCol && (selCol.visibility = checked ? 'show' : 'hide');
139139
onChange && onChange({columns: nColumns});
140140
};

src/firefly/js/templates/lightcurve/LcPeriodogram.jsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {updateSet} from '../../util/WebUtil.js';
3232
import HelpIcon from '../../ui/HelpIcon.jsx';
3333

3434
const algorOptions = [
35-
{label: 'LombScargle ', value: 'ls', proj: 'LCViewer'}
35+
{label: 'Lomb-Scargle ', value: 'ls', proj: 'LCViewer'}
3636
//{label: 'Box-fitting Least Squares', value: 'bls', proj: 'LCViewer'},
3737
//{label: 'Plavchan 2008', value: 'plav', proj: 'LCViewer'}
3838
];
@@ -526,17 +526,6 @@ function periodogramSuccess(popupId, hideDropDown = false) {
526526
sortInfo: sortInfoString('SDE', false) // sort peak table by column SDE, descending
527527
}, {tbl_id: LC.PEAK_TABLE, pageSize: parseInt(peak), noPeriodUpdate: true});
528528

529-
if (tReq2 !== null) {
530-
dispatchTableSearch(tReq2, {removable: true, tbl_group: LC.PERIODOGRAM_GROUP});
531-
const xyPlotParams = {
532-
x: {columnOrExpr: LC.PEAK_CNAME, options: 'grid'},
533-
y: {columnOrExpr: LC.POWER_CNAME, options: 'grid'},
534-
plotStyle: 'linepoints'
535-
536-
};
537-
loadXYPlot({chartId: LC.PEAK_TABLE, tblId: LC.PEAK_TABLE, xyPlotParams, help_id: 'findpTSV.pgramresults'});
538-
}
539-
540529
var tReq = makeTblRequest('LightCurveProcessor', LC.PERIODOGRAM_TABLE, {
541530
original_table: srcFile,
542531
x: get(defPeriod, [pKeyDef.time.fkey, 'value']) || get(layoutInfo, [LC.MISSION_DATA, LC.META_TIME_CNAME]),
@@ -569,6 +558,16 @@ function periodogramSuccess(popupId, hideDropDown = false) {
569558
help_id: 'findpTSV.pgramresults'
570559
});
571560
}
561+
if (tReq2 !== null) {
562+
dispatchTableSearch(tReq2, {removable: true, tbl_group: LC.PERIODOGRAM_GROUP});
563+
const xyPlotParams = {
564+
x: {columnOrExpr: LC.PEAK_CNAME, options: 'grid'},
565+
y: {columnOrExpr: LC.POWER_CNAME, options: 'grid'},
566+
plotStyle: 'linepoints'
567+
568+
};
569+
loadXYPlot({chartId: LC.PEAK_TABLE, tblId: LC.PEAK_TABLE, xyPlotParams, help_id: 'findpTSV.pgramresults'});
570+
}
572571

573572
dispatchActiveTableChanged(LC.PERIODOGRAM_TABLE, LC.PERIODOGRAM_GROUP);
574573
if (hideDropDown && popupId && isDialogVisible(popupId)) {

src/firefly/js/templates/lightcurve/LcViewer.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,18 @@ export class LcViewer extends Component {
9898

9999
var mainView = (err,converterId) => {
100100
if (!isEmpty(error) && converterId) {
101+
102+
let errorMsg = `Table uploaded is not ${getMissionName(converterId)} valid, missing columns: ${error}.
103+
Please, select option 'Other' for general table upload.`;
104+
105+
if (converterId === 'wise') {
106+
errorMsg = `The uploaded table is not valid. The ${getMissionName(converterId)} option requires frame_id, source_id, or both scan_id and frame_num.
107+
Please select the "Other" upload option for tables that do not meet these requirements.`;
108+
}
101109
return (
102110
<div
103111
style={{display:'flex', position:'absolute', border: '1px solid #a3aeb9', padding:20, fontSize:'150%'}}>
104-
{`Table uploaded is not ${getMissionName(converterId)} valid, missing columns: ${error}.
105-
Please, select option 'Basic' for general table upload.`}
112+
{errorMsg}
106113
<div>
107114
<HelpIcon helpId={'loadingTSV'}/>
108115
</div>

src/firefly/js/ui/DownloadDialog.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,18 @@ export class DownloadOptionPanel extends Component {
170170
}
171171

172172
render() {
173-
const {groupKey, cutoutSize, help_id, children, style} = this.props;
173+
const {groupKey, cutoutSize, help_id, children, style, title} = this.props;
174174
const {mask, sendEmail} = this.state;
175175
const labelWidth = 110;
176+
let ttl = title || DOWNLOAD_DIALOG_ID;
176177
return (
177178
<div style = {Object.assign({margin: '4px', position: 'relative', minWidth: 350}, style)}>
178179
{mask && <div style={{width: '100%', height: '100%'}} className='loading-mask'/>}
179180
<FormPanel
180181
submitText = 'Prepare Download'
181182
groupKey = {groupKey}
182183
onSubmit = {this.onSubmit}
183-
onCancel = {() => dispatchHideDialog(DOWNLOAD_DIALOG_ID)}
184+
onCancel = {() => dispatchHideDialog(ttl)}
184185
help_id = {help_id}>
185186
<FieldGroup groupKey={'DownloadDialog'} keepState={true}>
186187

src/firefly/js/visualize/ui/ImageSelectPanelResult.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {keyMap, panelKey, computeCurrentCatalogId, rgbFieldGroup, getTabsIndexes
66
PLOT_NO, RED, GREEN, BLUE, PLOT_CREATE, PLOT_CREATE3COLOR, rgb} from './ImageSelectPanel.jsx';
77
import WebPlotRequest from '../WebPlotRequest.js';
88
import {dispatchPlotImage, visRoot } from '../ImagePlotCntlr.js';
9-
import {findViewerWithItemId, getMultiViewRoot, IMAGE} from '../MultiViewCntlr.js';
9+
import {findViewerWithItemId, getViewer, getMultiViewRoot, IMAGE} from '../MultiViewCntlr.js';
1010
import {parseWorldPt} from '../Point.js';
1111
import {getPanelCatalogs} from './ImageSelectPanelProp.js';
1212
import {showInfoPopup} from '../../ui/PopupUtil.jsx';
@@ -308,11 +308,26 @@ export function resultSuccess(plotInfo, hideDropdown = false) {
308308
var groupId = null;
309309
var viewerIdOnPlot;
310310

311-
if ((plotInfo.addPlot&create) && plotInfo.viewerId) { // create plot case: only for fits viewer
311+
/* if ((plotInfo.addPlot&create) && plotInfo.viewerId) { // create plot case: only for fits
312+
//IRSA-142 LZ 4/07/17
313+
//When the image from different groups, the wcsMatch does not work since the match only matches the image within the same group.
314+
//If the group id exists, add the image into the same group
315+
*/
316+
if ((plotInfo.addPlot&create) && plotInfo.viewerId) {
312317
groupId = plotInfo.viewerId;
318+
const viewer = getViewer(getMultiViewRoot(), plotInfo.viewerId);
319+
320+
if (viewer && viewer.itemIdAry[0]) {
321+
const pv = getPlotViewById(visRoot(), viewer.itemIdAry[0]);
322+
if (pv) {
323+
groupId = pv.plotGroupId;
324+
}
325+
}
326+
313327
nPlotId = plotidGen.next().value;
314328
viewerIdOnPlot = plotInfo.viewerId;
315-
} else { // replace and with plotId
329+
}
330+
else { // replace and with plotId
316331
nPlotId = plotInfo.plotId;
317332
if (nPlotId) {
318333
groupId = getPlotViewById(visRoot(), nPlotId).plotGroupId;

0 commit comments

Comments
 (0)