Skip to content

Commit 67cfdbe

Browse files
authored
Merge pull request #1245 from Caltech-IPAC/firefly-1037-1038
Firefly-1037, Firefly-1038: multiple issues
2 parents 2bf52e9 + 881331e commit 67cfdbe

File tree

13 files changed

+164
-99
lines changed

13 files changed

+164
-99
lines changed
7.52 KB
Loading
2.28 KB
Loading

src/firefly/java/edu/caltech/ipac/firefly/server/visualize/ImagePlotCreator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ private static WebFitsData makeWebFitsData(ActiveFitsReadGroup frGroup, Band ban
285285
if (fr==null) return null;
286286
double dataMin= Double.NaN;
287287
double dataMax= Double.NaN;
288-
double standardErr= 0;
288+
double largeBinPercent= 0;
289289
if (!fr.isDeferredRead()) {
290290
Histogram hist= fr.getHistogram();
291291
dataMin= hist.getDNMin() * fr.getBscale() + fr.getBzero();
292292
dataMax= hist.getDNMax() * fr.getBscale() + fr.getBzero();
293-
standardErr= hist.getStandardErr();
293+
largeBinPercent= hist.getLargeBinPercent();
294294
}
295-
return new WebFitsData( dataMin, dataMax, standardErr, fileLength, fr.getFluxUnits());
295+
return new WebFitsData( dataMin, dataMax, largeBinPercent, fileLength, fr.getFluxUnits());
296296
}
297297

298298
public record PlotInfo(PlotState state, ImagePlot plot, FileInfo fileInfo,

src/firefly/java/edu/caltech/ipac/firefly/server/visualize/VisJsonSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ private static JSONObject serializeWebFitsData(WebFitsData wfData) {
292292
JSONObject map = new JSONObject();
293293
putDoubleNot0(map, "dataMin", wfData.dataMin());
294294
putDoubleNot0(map,"dataMax", wfData.dataMax());
295-
putDoubleNot0(map,"standardErr", wfData.standardErr());
295+
putDoubleNot0(map,"largeBinPercent", wfData.largeBinPercent());
296296
putStr(map, "fluxUnits", wfData.fluxUnits());
297297
putNum(map, "getFitsFileSize", wfData.fitsFileSize());
298298
return map;

src/firefly/java/edu/caltech/ipac/firefly/visualize/WebFitsData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
/**
77
* @author Trey Roby
88
*/
9-
public record WebFitsData(double dataMin, double dataMax, double standardErr, long fitsFileSize, String fluxUnits) { }
9+
public record WebFitsData(double dataMin, double dataMax, double largeBinPercent, long fitsFileSize, String fluxUnits) { }
1010

src/firefly/java/edu/caltech/ipac/visualize/plot/Histogram.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Histogram implements HasSizeOf {
2929
private double histBinsize;
3030
private final double irafMin;
3131
private final double irafMax;
32-
private final double standardErr;
32+
private final double largeBinPercent;
3333

3434

3535

@@ -152,7 +152,7 @@ else if (i>HISTSIZ2)
152152

153153
irafMin = datamin;
154154
irafMax = datamax;
155-
standardErr= get_sigma(1,true)/Math.sqrt(float1dArray.length);
155+
largeBinPercent= computeLargeBinPercent(float1dArray.length);
156156
}
157157

158158

@@ -270,6 +270,22 @@ public double get_pct(double ra_value, boolean round_up) {
270270
return ((i) * histBinsize + histMin);
271271
}
272272

273+
public double computeLargeBinPercent(int dataLen) {
274+
int cnt=0;
275+
276+
int histMax=0;
277+
for (int j : hist) {
278+
if (histMax < j) histMax = j;
279+
}
280+
int marker= (int)(histMax*.4);
281+
282+
283+
for (int j : hist) {
284+
if (j > marker) cnt++;
285+
}
286+
return (float)cnt/(float)hist.length;
287+
}
288+
273289
/**
274290
* @return A pointer to the histogram array
275291
*/
@@ -392,5 +408,5 @@ public long getSizeOf() {
392408
return hist.length*4L + 32L;
393409
}
394410

395-
public double getStandardErr() { return standardErr; }
411+
public double getLargeBinPercent() { return largeBinPercent; }
396412
}

src/firefly/js/ui/PopupUtil.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,14 @@ export function showOptionsPopup({content, title='Options', modal = false, show=
8484
* @param {string | object} content can be a string or a react component
8585
* @param {string} title
8686
* @param {boolean} [isCopyable] true or false, if undefined, then the default to true if it is a string
87+
* @param [wrapperStyle]
8788
* @return {object}
8889
*/
89-
export function showInfoPopup(content, title='Information', isCopyable=undefined) {
90+
export function showInfoPopup(content, title='Information', isCopyable=undefined, wrapperStyle) {
9091
if (isUndefined(isCopyable)) isCopyable = isString(content);
9192
var results= (
9293
<PopupPanel title={title} >
93-
{makeContent(content, isCopyable)}
94+
{makeContent(content, isCopyable, wrapperStyle)}
9495
</PopupPanel>
9596
);
9697
DialogRootContainer.defineDialog(INFO_POPUP, results);
@@ -104,10 +105,10 @@ export function hideInfoPopup() {
104105
dispatchHideDialog(INFO_POPUP);
105106
}
106107

107-
function makeContent(content, isCopyable) {
108+
function makeContent(content, isCopyable, wrapperStyle={}) {
108109
return (
109110
<div style={{padding:5}}>
110-
<div style={{minWidth:350, maxWidth: 400, padding:'10px 10px 15px 10px', fontSize:'120%', overflow: 'hidden'}}
111+
<div style={{minWidth:350, maxWidth: 500, padding:'10px 10px 15px 10px', fontSize:'120%', overflow: 'hidden', ...wrapperStyle}}
111112
className={isCopyable ? 'popup-panel-textcopyable' : ''}>
112113
{content}
113114
</div>

src/firefly/js/ui/VersionInfo.jsx

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
import {CopyToClipboard} from '../visualize/ui/MouseReadout.jsx';
77
import {showInfoPopup} from './PopupUtil.jsx';
88
import './VersionInfo.css';
9+
import IPAC_LOGO from 'images/ipac_logo-56x40.png';
10+
import CALTECH_LOGO from 'images/caltech-new-logo.png';
11+
import FFTOOLS_ICO from 'html/images/fftools-logo-offset-small-42x42.png';
912

1013
const VER = 'Version';
1114
const BUILT_ON = 'Built On';
@@ -49,28 +52,66 @@ function VersionInfoFull() {
4952
+ (ffTag ? `\n${FF_TAG}: ${ffTag}` : '');
5053

5154
return (
52-
<div style={{display: 'flex', justifyContent: 'space-evenly'}}>
53-
<div className='Version-grid'>
54-
<Entry desc={VER} value={version}/>
55-
<Entry desc={BUILT_ON} value={BuildTime}/>
56-
<Entry desc={COMMIT} value={BuildCommit}/>
57-
{major ? <Entry desc={FF_LIB} value={getFireflyLibraryVersionStr()}/> : ''}
58-
{ffCommit && <Entry desc={FF_COM} value={ffCommit}/>}
59-
{ffTag && <Entry desc={FF_TAG} value={ffTag}/>}
60-
{
61-
!isVersionFormalRelease() &&
62-
<div className='Version-grid-warning'>
63-
{isVersionPreRelease() ?
64-
`Warning: Early preview of Firefly ${getDevCycle()}` :
65-
`Warning: Development build of Firefly on dev cycle ${getDevCycle()}`
66-
}
55+
<div style={{display: 'flex', justifyContent: 'space-evenly', flexDirection:'column'}}>
56+
<div style={{display: 'flex', justifyContent: 'flex-start'}}>
57+
<div style={{paddingRight:10, display: 'flex', flexDirection:'column', alignItems:'center', marginTop:-20}}>
58+
<a href='https://github.com/Caltech-IPAC/firefly' target='github-window'><img alt='Firefly' src={FFTOOLS_ICO} style={{marginTop:10}}/></a>
59+
<a href='https://www.caltech.edu' target='caltech-window'><img style={{width:70}} alt='Caltech' src={CALTECH_LOGO}/></a>
60+
<a href='https://www.ipac.caltech.edu' target='ipac-window'><img alt='IPAC' src={IPAC_LOGO}/></a>
61+
</div>
62+
<div style={{display: 'flex', justifyContent: 'space-evenly', marginLeft:60, alignItems:'flex-start'}}>
63+
<div className='Version-grid'>
64+
<Entry desc={VER} value={version}/>
65+
<Entry desc={BUILT_ON} value={BuildTime}/>
66+
<Entry desc={COMMIT} value={BuildCommit}/>
67+
{major ? <Entry desc={FF_LIB} value={getFireflyLibraryVersionStr()}/> : ''}
68+
{ffCommit && <Entry desc={FF_COM} value={ffCommit}/>}
69+
{ffTag && <Entry desc={FF_TAG} value={ffTag}/>}
6770
</div>
68-
}
71+
<CopyToClipboard style={{justifySelf: 'start', marginLeft:10}}
72+
value={versionAsText} size={16} buttonStyle={{backgroundColor: 'unset'}}/>
73+
</div>
6974
</div>
70-
<CopyToClipboard style={{justifySelf: 'end', marginLeft: 10}}
71-
value={versionAsText} size={16} buttonStyle={{backgroundColor: 'unset'}}/>
75+
{
76+
!isVersionFormalRelease() &&
77+
<div className='Version-grid-warning'>
78+
{isVersionPreRelease() ?
79+
`Warning: Early preview of Firefly ${getDevCycle()}` :
80+
`Warning: Development build of Firefly on dev cycle ${getDevCycle()}`
81+
}
82+
</div>
83+
}
84+
<Acknowledgement/>
7285
</div>
7386
);
7487
}
7588

76-
export const showFullVersionInfoDialog = (title = '') => showInfoPopup( <VersionInfoFull/>, `${title} Version Information`);
89+
90+
const Acknowledgement= () => (
91+
<div style={{padding:'10px 5px 3px 5px', width:600, fontSize:'smaller'}}>
92+
<span>
93+
Firefly development at&nbsp;
94+
</span>
95+
<a href='https://ipac.caltech.edu' target='ipac-window'>IPAC</a>
96+
<span>
97+
&nbsp;has been supported by NASA, principally through&nbsp;
98+
</span>
99+
<a href='https://irsa.ipac.caltech.edu' target='ipac-window'>IRSA</a>
100+
<span>
101+
, and by the National Science Foundation, through the&nbsp;
102+
</span>
103+
<a href='https://www.lsst.org/' target='rubin-window'>Vera C. Rubin Observatory</a>
104+
<span>
105+
. Firefly is open-source software, available on&nbsp;
106+
</span>
107+
<a href='https://github.com/Caltech-IPAC/firefly' target='github-window'>GitHub</a>
108+
<span> and </span>
109+
<a href='https://hub.docker.com/repository/docker/ipac/firefly' target='dockerhub-window'>DockerHub</a>
110+
<span>.</span>
111+
</div>
112+
113+
);
114+
115+
116+
117+
export const showFullVersionInfoDialog = (title = '') => showInfoPopup( <VersionInfoFull/>, `${title} Version Information`, true, {maxWidth:620});

src/firefly/js/visualize/WebPlot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const HIPS_DATA_HEIGHT= 10000000000;
9898
*
9999
* @prop {number} dataMin
100100
* @prop {number} dataMax
101-
* @prop {number} standardErr,
101+
* @prop {number} largeBinPercent,
102102
* @prop {number} fitsFileSize
103103
* @prop {number} fluxUnits
104104
*/

src/firefly/js/visualize/rawData/RawDataOps.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ function clearLocalStretchData(plot) {
211211
entry.dataType= CLEARED;
212212
}
213213

214+
function isNoisyImage(plot) {
215+
return (!isThreeColor(plot) && plot.webFitsData[Band.NO_BAND.value].largeBinPercent>.03);
216+
}
217+
214218
/**
215219
* @param {WebPlot} plot
216220
* @param {boolean} mask
@@ -220,7 +224,7 @@ function getFirstDataCompress(plot, mask) {
220224
if (mask) return 'FULL';
221225
const {dataWidth, dataHeight}= plot;
222226
const size= dataWidth*dataHeight;
223-
if (!isThreeColor(plot) && plot.webFitsData[Band.NO_BAND.value].standardErr<.01) { //these type of image don't seem to compress very well
227+
if (isNoisyImage(plot)) { //these type of image don't seem to compress very well
224228
return (size < 55*MEG) ? 'FULL' : 'QUARTER';
225229
}
226230
if (size < 6*MEG) return 'FULL';
@@ -241,7 +245,7 @@ function getNextDataCompress(firstCompress, plot) {
241245
const size= dataWidth*dataHeight;
242246
if (firstCompress!=='QUARTER' && size < MAX_FULL_DATA_SIZE) return 'FULL';
243247
if (size > MAX_FULL_DATA_SIZE) return 'HALF';
244-
if (!isThreeColor(plot) && plot.webFitsData[Band.NO_BAND.value].standardErr<.01) { //these type of image don't seem to compress very well
248+
if (isNoisyImage(plot)) { //these type of image don't seem to compress very well
245249
return 'FULL';
246250
}
247251
if (size > 70*MEG && zoomFactor<.4) return 'HALF';

0 commit comments

Comments
 (0)