-
Notifications
You must be signed in to change notification settings - Fork 16
IRSA-540, IRSA-541:Add PTF case to Time Series Tool #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add PTF option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both PTFMissionOptions and PTFplotRequsets serve as place holder for now, as they are converted from wise They will be rewritten for PTF image date retrieve when implementing IRSA-514.
Everything else looks fine. BTW PTF has green and red filters, no w1 and w2 band.
Correct the band names
if ((colType.includes(col.type)) && | ||
(!has(col, 'visibility') || get(col, 'visibility') !== 'hidden') && | ||
(col.name.startsWith(val))) { | ||
prev.push(col.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here. This is copy/paste code that should be in util.
@@ -105,6 +105,12 @@ export class LcViewer extends PureComponent { | |||
errorMsg = `The uploaded table is not valid. The ${getMissionName(converterId)} option requires frame_id, source_id, or both scan_id and frame_num. | |||
Please select the "Other" upload option for tables that do not meet these requirements.`; | |||
} | |||
|
|||
if (converterId === 'ptf') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LcViewer is generic code and should not have 'ptf' references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loi, this code has been introduced to deal with specific error and we said last time we will cleanup and refactor the code but never get to it. I think we have time to do it and i propose to Lijun to go ahead and spend time to at least do this part and cleanup as much as possible, specially because we will use again for ZTF.
@lznakano , my proposal is the following: make use of {{converters.wise.isTableUploadValid}} function from the LcConverterFactory.js
.
I've introduced this function in the past but is not used in the common code, only in WiseMissionOption.js
.
Among other cleanup that you might want to do and simply the code, I'd suggest at least to replace this piece of code:
if (converterId === 'ptf') {
errorMsg = `The uploaded table is not valid. The ${getMissionName(converterId)} option requires pid.
Please select the "Other" upload option for tables that do not meet these requirements.`;
}
with:
errorMsg = converterData.isTableUploadValid(converterId)
or something similar.
Right now, the function isTableUploadValid
returns a boolean value but you can return a function with {errorMsg:'yada yada', isValid:boolean}
and use it in LcViewer.jsx
to show the error message if validation fails.
Of course, you will need to add a specific function for PTF in PTFMissionOptions.js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
is a string and meant to be used as an error message. So, the code here can simply display the error message if exists. It should not even care about converterId. Mission specific message can be set in onNewRawTable
. You can see wiseOnNewRawTable
as an example.
(!has(col, 'visibility') || get(col, 'visibility') !== 'hidden')) { | ||
prev.push(col.name); | ||
} | ||
return prev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These sort of functions should be in TableUtil.js. It would also be easier to read if written as:
return get(rawTbl, ['tableData', 'columns'])
.filter((col) => colType.includes(col.type) && get(col, 'visibility') !== 'hidden')
.map((col) => col.name);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was in WiseMissionOption. I moved it here without making any changes. I will make the necessary changes and then put it in TableUtils.js.
* @type {string[]} | ||
*/ | ||
const xyColPattern = ['\\w*jd\\w*', 'w[1-4]mpro\\w*']; | ||
export function ptfOnNewRawTable(rawTable, missionEntries, generalEntries, converterData, layoutInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xyColPattern = ['\wjd\w', 'w[1-4]mpro\w*'];
This is wise's specific. I doubt it'll work for ptf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lijun, As I have commented before both PTFMissionOptions and PTFplotRequests will be rewritten for PTF data when implementing IRSA-514, don't need to make any changes as far as to dealing with PTF data specifics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wmiipac for ticket IRSA-514, you only need to care about PTFPlotRequests.js
. Why do you care about PTFMissionOptions.js
? You shouldn't, right?
I agree that the request will be different of course but is fair to add code as part of the PR so you get a code to change only ;-)
/** | ||
* Returns only numerical column names form raw lc table | ||
* @param {Object} rawTbl | ||
* @returns {TableColumn[]} - array of table columns objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. It's returning string[] - array of column names, not TableColumn[].
Refactor and rearrange the codes will be done after real PTF specific parameters are in place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Couple of comments:
As Loi suggested, we shouldn't have any code specific in the common code. Only in the mission options panel. Please, remove the PTF code from common part otherwise it will become unmaintanible.
Also, take out or commented out the WISE code in the image specific function, is probably going to be reused anyway but not with same pattern.
That would be good to have the cleanup/refactor as much as possible before merging. If you see the opportunity to identify repeated code, please move it in util class so it cna be reused most probably by ZTF in the (near future).
Overall is good progress!
I also suggest as part of this ticket to add the PTF option in IRSAViewer (IFE) part.
Thank you!
Also, the band label should display a lower-case 'g' not 'G'. 'R' is fine. |
@@ -96,7 +96,7 @@ export class LcViewer extends PureComponent { | |||
const LcPeriodInstance= get(getAppOptions(), 'charts.chartEngine')==='plotly' ? LcPeriodPlotly : LcPeriod; | |||
|
|||
var mainView = (err,converterId) => { | |||
if (!isEmpty(error) && converterId) { | |||
if (error!='undefined' && !isEmpty(error) && converterId) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isEmpty(undefined) will return true. but here, it's checking for a string 'undefined'.
import {DefaultSettingBox, defaultOnNewRawTable, defaultOnFieldUpdate, defaultRawTableRequest} from './generic/DefaultMissionOptions.js'; | ||
import {BasicSettingBox, basicOnNewRawTable, basicOnFieldUpdate, basicRawTableRequest, imagesShouldBeDisplayed} from './basic/BasicMissionOptions.js'; | ||
import {WiseSettingBox, wiseOnNewRawTable, wiseOnFieldUpdate, wiseRawTableRequest, isBasicTableUploadValid} from './wise/WiseMissionOptions.js'; | ||
import {PTFSettingBox, ptfOnNewRawTable, ptfOnFieldUpdate, ptfRawTableRequest} from './PTF/PTFMissionOptions.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, change to lower-case 'ptf' directory. it make more sense and is cleaner. Thanks.
Refactor the codes in this package
I have done lot of refactoring. There are so many duplications. I combined some methods to one which can be used by all missions and also moved some common methods to the LcUtil.jsx. After PTF images are added, it is possible to do further refactoring. I have pushed ife branch with the same name "IRSA-540-IRSA-541-PTF". Please check out firefly and ife branches and have a look. Thanks! |
There are some duplications in wise and ptf options. I removed them last Friday but added back today as place holders. RawTableRequest and FiledUpdate are such functions. I would wait until the PFT image loaded to see if these two functions in two mission need to be different or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine. I cleanup TableUtils.js and push my changes. I did not do testing because I do not have a ptf file readily available. But, I assumed @ejoliet have. Good to go.
[LC.META_FLUX_BAND]: Object.assign(getTypeData(LC.META_FLUX_BAND, '', '' + | ||
'Select WISE band for images to be displayed', 'Image display:', 70)), | ||
[LC.META_ERR_CNAME]: Object.assign(getTypeData(LC.META_ERR_CNAME, '', | ||
'value error column name', 'Error Column:', labelWidth)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I removed a few non-ascii characters from here. However, the code could use some cleaning up. Object.assign() is used with only 1 parameter, why? Also, why is there a '' + 'Select...'
clean up none used codes
Add comments
Two tickets were implemented together. A new PTF form is created and added. Corresponding actions in the form were implemented.