Comments (9)
hmm ... I am trying to remember in which case I am using this method.
I think this is used in the case of scan spiders only. It was created to help the user check that the assessor with a prototype and the a scan is unusable or not. E.G: bedpost checking for dtiQA (same scan) if I remember. It shouldn't be used for checking a session_processor status.
I am not sure I see in which case you want to use this for a session processor.
from dax.
Bedpost with DTIQA multi.
From: Benjamin Yvernault [[email protected]]
Sent: Monday, February 15, 2016 12:02 PM
To: VUIIS/dax
Cc: Damon, Stephen M
Subject: Re: [dax] is_assessor_same_scan_unusable is broken for session processors (#48)
hmm ... I am trying to remember in which case I am using this method.
I think this is used in the case of scan spiders only. It was created to help the user check that the assessor with a prototype and the a scan is unusable or not. E.G: bedpost checking for dtiQA (same scan) if I remember. It shouldn't be used for checking a session_processor status.
I am not sure I see in which case you want to use this for a session processor.
�
Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-184327941.
from dax.
In that case, It's not on the same scan since it's an assessor on the session.
I would see the processor run() like :
If assessor_dtiqa_multi.exists() and XnatUtils.is_assessor_usable(assessor_dtiqa_multi):
return ...
elif XnatUtils.is_assessor_same_scan_unusable(cscan, proctype):
return ...
I see what you want to do and I agree we should add that by either creating a new function (we don't have to) or just rename the function and add you're idea of the flag and probably call the function :
is_assessor_on_same_session_unusable(cscan, proctype)
The function will work in both case. Maybe something that is then more generic.
What do you think?
Cheers,
Ben
from dax.
Hey Steve,
What do you think about something like this:
def is_assessor_on_same_session_unusable(cobj, proctype, is_scan_proc=False):
"""
Check to see if the assessor matching the user passed scan and proctype has
passed QC.
:param cob: CachedImage object from XnatUtils (scan/session)
:param proctype: Process type of the assessor to check
:param is_scan_proc: if the processor is a scan level processor
:return: 0 if the assessor is not ready or doesn't exist. -1 if it failed,
or 1 if OK
"""
obj_info = cobj.info()
assr_list = list()
if isinstance(cobj, 'CachedImageScan'):
if is_scan_proc:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], obj_info['ID'], proctype])
else:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], proctype])
assr_list = [cassr.info() for cassr in cobj.parent().assessors() if cassr.info()['label'] == assr_label]
elif isinstance(cobj, 'CachedImageSession'):
assr_list = [cassr.info() for cassr in cobj.assessors() if cassr.info()['proctype'] == proctype]
if not assr_list:
return 0
elif len(assr_list) == 1:
return is_bad_qa(assr_list[0]['qcstatus'])
else:
# too many assessors checked if one rdy??
good_assr_list = [assr_info['label'] for assr_info in assr_list if is_bad_qa(assr_info['qcstatus']) == 1]
if len(good_assr_list) == 1:
return 1
elif len(good_assr_list) > 1:
print "WARNING: too many assessors %s with a good QC status." % (proctype)
return 0
return 0
The one thing I am not sure yet is that if there is more than one assessor in the list found with the proctype (e.g: two dtiQA on a session for a session assessor that is checking on dtiQA). Maybe check if only one is good if not let the user know.
Let me know what you think,
Cheers,
Ben
from dax.
I like it. I was also thinking about the case of multiple assessors. Two thoughts here: 1) Returns the list and make the user filter further. 2) Or give an optional list of scan types? This could also still have the case of multiple hits for certain projects with multiple fMRI runs of the same type.
from dax.
hmmm, we could also separate this function in two:
- one to return the list of cassr from a cobj (scan or session) where we give the proctype we want to search for.
- change the code to get the assr_list in the previous method.
Something like:
def get_cassr_on_same_session(cobj, proctype, is_scan_proc=False):
"""
Get the list of all assessors with the proctype given for a cobj (session, scan)
:param cobj: CachedImage object from XnatUtils (scan/session)
:param proctype: Process type of the assessor to check
:param is_scan_proc: if the processor is a scan level processor
:return: list of CachedImageAssessor objects
"""
obj_info = cobj.info()
cassr_list = list()
if isinstance(cobj, 'CachedImageScan'):
if is_scan_proc:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], obj_info['ID'], proctype])
else:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], proctype])
cassr_list = [cassr for cassr in cobj.parent().assessors() if cassr.info()['label'] == assr_label]
elif isinstance(cobj, 'CachedImageSession'):
cassr_list = [cassr for cassr in cobj.assessors() if cassr.info()['proctype'] == proctype]
return cassr_list
def is_assessor_on_same_session_usable(cobj, proctype, is_scan_proc=False):
"""
Check to see if the assessor matching the user passed scan and proctype has
passed QC.
:param cobj: CachedImage object from XnatUtils (scan/session)
:param proctype: Process type of the assessor to check
:param is_scan_proc: if the processor is a scan level processor
:return: 0 if the assessor is not ready or doesn't exist. -1 if it failed,
or 1 if OK
"""
cassr_list = get_cassr_on_same_session(cobj, proctype, is_scan_proc)
if not cassr_list:
return 0
elif len(cassr_list) == 1:
return is_bad_qa(cassr_list[0].info()['qcstatus'])
else:
# too many assessors checked if one rdy??
good_cassr_list = [cassr.info() for cassr in cassr_list if is_bad_qa(cassr.info()['qcstatus']) == 1]
if len(good_cassr_list) == 1:
return 1
elif len(good_cassr_list) > 1:
print "WARNING: too many assessors %s with a good QC status." % (proctype)
return 0
return 0
Then users can just get all the assessor good for the cobj and do what they want with it or just use the is_assessor .... function to know if the assessor is good or no.
For the scan type, you mean give a list of proctypes for the scan level processor?
from dax.
I like it!
From: Benjamin Yvernault [[email protected]]
Sent: Tuesday, February 16, 2016 9:36 AM
To: VUIIS/dax
Cc: Damon, Stephen M
Subject: Re: [dax] is_assessor_same_scan_unusable is broken for session processors (#48)
hmmm, we could also separate this function in two:
- one to return the list of cassr from a cobj (scan or session) where we give the proctype we want to search for.
- change the code to get the assr_list in the previous method.
Something like:
def get_cassr_on_same_session(cobj, proctype, is_scan_proc=False):
"""
Get the list of all assessors with the proctype given for a cobj (session, scan)
:param cobj: CachedImage object from XnatUtils (scan/session)
:param proctype: Process type of the assessor to check
:param is_scan_proc: if the processor is a scan level processor
:return: list of CachedImageAssessor objects
"""
obj_info = cobj.info()
cassr_list = list()
if isinstance(cobj, 'CachedImageScan'):
if is_scan_proc:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], obj_info['ID'], proctype])
else:
assr_label = '-x-'.join([obj_info['project_id'], obj_info['subject_label'], obj_info['session_label'], proctype])
cassr_list = [cassr for cassr in cobj.parent().assessors() if cassr.info()['label'] == assr_label]
elif isinstance(cobj, 'CachedImageSession'):
cassr_list = [cassr for cassr in cobj.assessors() if cassr.info()['proctype'] == proctype]
return cassr_list
def is_assessor_on_same_session_usable(cobj, proctype, is_scan_proc=False):
"""
Check to see if the assessor matching the user passed scan and proctype has
passed QC.
:param cobj: CachedImage object from XnatUtils (scan/session)
:param proctype: Process type of the assessor to check
:param is_scan_proc: if the processor is a scan level processor
:return: 0 if the assessor is not ready or doesn't exist. -1 if it failed,
or 1 if OK
"""
cassr_list = get_cassr_on_same_session(cobj, proctype, is_scan_proc)
if not cassr_list:
return 0
elif len(cassr_list) == 1:
return is_bad_qa(cassr_list[0].info()['qcstatus'])
else:
# too many assessors checked if one rdy??
good_cassr_list = [cassr.info() for cassr in cassr_list if is_bad_qa(cassr.info()['qcstatus']) == 1]
if len(good_cassr_list) == 1:
return 1
elif len(good_cassr_list) > 1:
print "WARNING: too many assessors %s with a good QC status." % (proctype)
return 0
return 0
�
Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-184733212.
from dax.
Ok doing a push request for that.
from dax.
Done
from dax.
Related Issues (20)
- Dax build logs exit with no errors when yaml file from REDCap for processor missing. HOT 2
- Test dax validate HOT 2
- Unexpected behavior in build logging
- Catch module code errors
- upload error with cwd
- Spurious error in job counts
- upload specific job HOT 1
- Data Pipeline Flexibility with Special Characters HOT 2
- Dax relaunching failed jobs(memory and time limit)
- .netrc file with XNAT that has login, user and password HOT 7
- Allow variable number of inputs HOT 1
- XnatCheckLogin should append to .netrc if no host entry present
- PDF autostamper isn't working well
- Xnatdownload bugs HOT 2
- needs_usable option for yaml HOT 2
- No longer valid request for "URI" entry in some tables
- -f option ignored with XnatSwitchProcessStatus --restart HOT 1
- Too many REDCap hits to update build times
- Consolidate API requests from REDCap sync module?
- Remove BIDS/BOND dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dax.