Skip to content

Commit

Permalink
Update bwm_figs.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mschart authored Oct 1, 2024
1 parent 3827cc4 commit 42fb220
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions brainwidemap/meta/bwm_figs.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ def plot_swansons(variable, fig=None, axs=None):
f'{ana}_significant'] == True][
f'{ana}_{dt}'].values

vmax = np.max(scores)
vmin = np.min(scores)

if lat:
mask = res[np.bitwise_or(
res[f'{ana}_significant'] == False,
Expand All @@ -482,8 +485,14 @@ def plot_swansons(variable, fig=None, axs=None):
else:
acronyms = res['region'].values
scores = res[f'{ana}_effect'].values
mask = []
mask = []

if variable == 'stim':
vmax = np.percentile(scores, 95)
vmin = np.percentile(scores, 5)
else:
vmax = np.max(scores)
vmin = np.min(scores)

plot_swanson_vector(acronyms,
scores,
Expand All @@ -499,10 +508,12 @@ def plot_swansons(variable, fig=None, axs=None):
annotate= True,
annotate_n=5,
annotate_order='bottom' if lat else 'top',
fontsize=f_size_s)
fontsize=f_size_s,
vmin=vmin,
vmax=vmax)

clevels = (min(scores), max(scores))
norm = mpl.colors.Normalize(vmin=clevels[0], vmax=clevels[1])

norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax)
cbar = fig.colorbar(
mpl.cm.ScalarMappable(norm=norm,cmap=cmap.reversed()
if lat else cmap),
Expand Down Expand Up @@ -2290,8 +2301,8 @@ def get_example_results():
lambda c: c == -1,
0.2,
0.05,
"fmoveL", #fmoveL
"fmoveR", #fmoveR
"fmoveL", #choice left
"fmoveR", #choice right
),
"feedback_times": (
"feedbackType",
Expand All @@ -2309,7 +2320,7 @@ def get_example_results():
"stim": (
'e0928e11-2b86-4387-a203-80c77fab5d52', # EID
'799d899d-c398-4e81-abaf-1ef4b02d5475', # PID
235, # clu_id, was 235
235, # clu_id, was 235 -- online 218 looks good
"VISp", # region
0.04540706, # drsq (from 02_fit_sessions.py)
"stimOn_times", # Alignset key
Expand Down Expand Up @@ -3350,13 +3361,13 @@ def ghostscript_compress_pdf(variable, level='/printer'):
output_path = Path(imgs_pth, variable,
f'n5_main_figure_{variverb[variable]}_revised.pdf')

if variable == 'wheel':
elif variable == 'wheel':
input_path = Path(imgs_pth, 'speed',
f'n5_main_figure_wheel_revised_raw.pdf')
output_path = Path(imgs_pth, 'speed',
f'n5_main_figure_wheel_revised.pdf')

if variable == 'manuscript':
elif variable == 'manuscript':
input_path = Path('/home/mic/Brainwide_Map_Paper.pdf')
output_path = Path('/home/mic/Brainwide_Map_Paper2.pdf')

Expand Down Expand Up @@ -3389,3 +3400,4 @@ def ghostscript_compress_pdf(variable, level='/printer'):




0 comments on commit 42fb220

Please sign in to comment.