Skip to content

Commit

Permalink
Merge pull request #571 from neuroscout/fix/bib
Browse files Browse the repository at this point in the history
Fix bibliography + database backups, add scaling to DM plots
  • Loading branch information
adelavega committed May 16, 2019
2 parents 803ca18 + b3b17f2 commit 850c90b
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 7 deletions.
4 changes: 2 additions & 2 deletions celery_worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def compile(analysis, predictor_events, resources, bids_dir, run_ids,

@celery_app.task(name='workflow.generate_report')
def generate_report(analysis, predictor_events, bids_dir, run_ids,
sampling_rate, domain):
sampling_rate, domain, scale):
_, _, bids_analysis = build_analysis(
analysis, predictor_events, bids_dir, run_ids)
outdir = Path('/file-data/reports') / analysis['hash_id']
Expand Down Expand Up @@ -74,7 +74,7 @@ def generate_report(analysis, predictor_events, bids_dir, run_ids,
results['design_matrix'].append(url)
dense.to_csv(out, index=False)

dm_plot = plot_design_matrix(dense)
dm_plot = plot_design_matrix(dense, scale=scale)
results['design_matrix_plot'].append(dm_plot)

corr_plot = plot_corr_matrix(dense)
Expand Down
4 changes: 3 additions & 1 deletion celery_worker/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def melt_dm(dm):
return dm.melt('scan_number', var_name='regressor', value_name='value')


def plot_design_matrix(dm_wide):
def plot_design_matrix(dm_wide, scale=True):
if scale:
dm_wide = dm_wide.apply(lambda x: x / x.max()) # Scale for plotting
dm = melt_dm(dm_wide)

pts = alt.selection_multi(encodings=['x'])
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
env_file:
- .env
- .pliersenv

swagger-ui:
image: swaggerapi/swagger-ui
Expand Down
160 changes: 160 additions & 0 deletions neuroscout/config/bibliography.json
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,166 @@
]
},
"PredefinedDictionaryExtractor": {
"concreteness.*": [
{
"id": "http://zotero.org/users/local/JXz6ijqB/items/Z8ZF6ICY",
"type": "article-journal",
"title": "Concreteness ratings for 40 thousand generally known English word lemmas",
"container-title": "Behavior Research Methods",
"page": "904-911",
"volume": "46",
"issue": "3",
"source": "DOI.org (Crossref)",
"URL": "http://link.springer.com/10.3758/s13428-013-0403-5",
"DOI": "10.3758/s13428-013-0403-5",
"ISSN": "1554-3528",
"journalAbbreviation": "Behav Res",
"language": "en",
"author": [
{
"family": "Brysbaert",
"given": "Marc"
},
{
"family": "Warriner",
"given": "Amy Beth"
},
{
"family": "Kuperman",
"given": "Victor"
}
],
"issued": {
"date-parts": [
[
"2014",
9
]
]
},
"accessed": {
"date-parts": [
[
"2019",
5,
15
]
]
}
}
],
"calgarysemanticdecision.*" : [
{
"id": "http://zotero.org/users/local/JXz6ijqB/items/D5EM4SZP",
"type": "article-journal",
"title": "The Calgary semantic decision project: concrete/abstract decision data for 10,000 English words",
"container-title": "Behavior Research Methods",
"page": "407-417",
"volume": "49",
"issue": "2",
"source": "Springer Link",
"URL": "https://doi.org/10.3758/s13428-016-0720-6",
"DOI": "10.3758/s13428-016-0720-6",
"ISSN": "1554-3528",
"shortTitle": "The Calgary semantic decision project",
"journalAbbreviation": "Behav Res",
"language": "en",
"author": [
{
"family": "Pexman",
"given": "Penny M."
},
{
"family": "Heard",
"given": "Alison"
},
{
"family": "Lloyd",
"given": "Ellen"
},
{
"family": "Yap",
"given": "Melvin J."
}
],
"issued": {
"date-parts": [
[
"2017",
4,
1
]
]
},
"accessed": {
"date-parts": [
[
"2019",
5,
15
]
]
}
}
],
"massiveauditorylexicaldecision.*": [
{
"id": "http://zotero.org/users/local/JXz6ijqB/items/KHYK769U",
"type": "article-journal",
"title": "The Massive Auditory Lexical Decision (MALD) database",
"container-title": "Behavior Research Methods",
"source": "Springer Link",
"URL": "https://doi.org/10.3758/s13428-018-1056-1",
"DOI": "10.3758/s13428-018-1056-1",
"ISSN": "1554-3528",
"journalAbbreviation": "Behav Res",
"language": "en",
"author": [
{
"family": "Tucker",
"given": "Benjamin V."
},
{
"family": "Brenner",
"given": "Daniel"
},
{
"family": "Danielson",
"given": "D. Kyle"
},
{
"family": "Kelley",
"given": "Matthew C."
},
{
"family": "Nenadić",
"given": "Filip"
},
{
"family": "Sims",
"given": "Michelle"
}
],
"issued": {
"date-parts": [
[
"2018",
6,
18
]
]
},
"accessed": {
"date-parts": [
[
"2019",
5,
15
]
]
}
}
],
"subtlexusfrequency.*":[
{
"id": "http://zotero.org/users/local/JXz6ijqB/items/HK7TT8RJ",
Expand Down
2 changes: 1 addition & 1 deletion neuroscout/resources/analysis/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def get(self, analysis):

tools = [b['.*'] for k, b in bib.items()
if k in ['nipype', 'neuroscout', 'fitlins', 'nipype']]
all_csl_json = tools
all_csl_json = tools.copy()

dataset_entry = bib.get(analysis.dataset.name, [])
if dataset_entry:
Expand Down
8 changes: 5 additions & 3 deletions neuroscout/resources/analysis/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ def get(self, analysis):
@use_kwargs({
'run_id': wa.fields.DelimitedList(fields.Int(),
description='Run id(s).'),
'sampling_rate': wa.fields.Number(description='Sampling rate in Hz')
'sampling_rate': wa.fields.Number(description='Sampling rate in Hz'),
'scale': wa.fields.Boolean(description='Scale columns for plotting'),
}, locations=['query'])
@doc(tags=['analysis'])
class ReportResource(MethodResource):
@doc(summary='Generate analysis reports.')
@fetch_analysis
def post(self, analysis, run_id=None, sampling_rate=None):
def post(self, analysis, run_id=None, sampling_rate=None, scale=True):
# Submit report generation
analysis_json, pes_json = jsonify_analysis(analysis, run_id=run_id)

Expand All @@ -102,7 +103,8 @@ def post(self, analysis, run_id=None, sampling_rate=None):
args=[analysis_json, pes_json,
analysis.dataset.local_path, run_id,
sampling_rate,
current_app.config['SERVER_NAME']])
current_app.config['SERVER_NAME'],
scale])

# Create new Report
report = Report(
Expand Down

0 comments on commit 850c90b

Please sign in to comment.