How to use get_node method in avocado

Best Python code snippet using avocado_python

preprocess.py

Source:preprocess.py Github

copy

Full Screen

...29 30 self.preprocessing(preprocess, func_dic)31 self.get_warps(preprocess)32 33 preprocess.connect([(inputnode, preprocess.get_node('Fregistration'), [('T1w', 'T1w'),34 ('mask', 'mask')]),35 #(inputnode, preprocess.get_node('bet'), [('T1w', 'inputnode.in_files')]),36 (inputnode, preprocess.get_node('bet'), [('T1w', 'T1w')]),37 (inputnode, preprocess.get_node('slicetimer'), [('TR', 'time_repetition')]),38 (inputnode, preprocess.get_node('extract'), [('bold', 'in_file')]),39 (inputnode, preprocess.get_node('warp'), [('mask', 'ref_file')]),40 (inputnode, preprocess.get_node('prelim'), [('mask', 'reference')]),41 (inputnode, preprocess.get_node('dilateref'), [('mask', 'in_file')]),42 (inputnode, preprocess.get_node('Fmni'), [('mask', 'mniMask')]),43 (preprocess.get_node('bet_strip'), preprocess.get_node('warp'), [('out_file', 'in_file')]),44 (preprocess.get_node('bet_strip'), preprocess.get_node('invwarp'), [('out_file', 'brain')]),45 (preprocess.get_node('Fregistration'), preprocess.get_node('invwarp'), [('out_mat', 'coregmat')]),46 (preprocess.get_node('Fmni'), preprocess.get_node('invwarp'), [('brainmask', 'brainmask')]),47 (preprocess.get_node('bet_strip'), preprocess.get_node('prelim'), [('out_file', 'in_file')]),48 (preprocess.get_node('bet_strip'), preprocess.get_node('decision'), [('out_file', 'mask')]),49 (preprocess.get_node('bet_strip'), preprocess.get_node('dilatebrain'), [('out_file', 'in_file')]),50 (preprocess.get_node('warp'), preprocess.get_node('Fmni'), [('field_file', 'warp')]),51 ])52 53 outnode = Node(IdentityInterface(fields=['smoothed', 'segmentations', 'warp_file', 'brain', 'brainmask', 'outliers', 'unsmoothed', 'invwarp', 'keepreg', 'keepsmooth']), name='outnode')54 55 preprocess.connect([(preprocess.get_node('bet_strip'), outnode, [('out_file', 'brain')]),56 (preprocess.get_node('Fmni'), outnode, [('segmentations', 'segmentations')]),57 (preprocess.get_node('Fsmooth'), outnode, [('smooth', 'smoothed')]),58 (preprocess.get_node('Fsmooth'), outnode, [('files', 'keepsmooth')]),59 #(preprocess.get_node('warp'), outnode, [('field_file', 'warp_file')]),60 (preprocess.get_node('Fmni'), outnode, [('warp', 'warp_file')]),61 (preprocess.get_node('invwarp'), outnode, [('invwarp', 'invwarp')]),62 #(preprocess.get_node('mcflirt'), outnode, [('par_file', 'mc_par')]),63 (preprocess.get_node('art'), outnode, [('outlier_files', 'outliers')]),64 #(preprocess.get_node('Fregistration'), outnode, [('out_mat', 'coregmat')]),65 (preprocess.get_node('Fregistration'), outnode, [('files', 'keepreg')]),66 (preprocess.get_node('fillmask'), outnode, [('out_file', 'brainmask')]),67 ])68 69 if 'rest' in self.task:70 preprocess.connect([(preprocess.get_node('Fregress'), outnode, [('forreho', 'unsmoothed')]),71 ])72 else:73 preprocess.connect([(preprocess.get_node('Fmni'), outnode, [('warped', 'unsmoothed')]),74 ])75 76 77 write = Node(Function(input_names=['base_dir', 'pipeline_st', 'task']+intermediates), name='write')78 write.inputs.function_str = get_sink(intermediates)79 write.inputs.base_dir = self.base_dir80 write.inputs.pipeline_st = self.pipeline81 write.inputs.task = self.task82 83 preprocess.connect([(preprocess.get_node('bet_strip'), write, [('out_file', 'brain')]),84 (preprocess.get_node('Fsmooth'), write, [('smooth', 'smoothed')]),85 (preprocess.get_node('Fregistration'), write, [('out_mat', 'coregmat')]),86 (preprocess.get_node('fast'), write, [('tissue_class_files', 'segmentations')]),87 (preprocess.get_node('warp'), write, [('field_file', 'warp_field'),88 ('warped_file', 'warp')]),89 (preprocess.get_node('invwarp'), write, [('invwarp', 'invwarp')]),90 (preprocess.get_node('art'), write, [('outlier_files', 'outliers'),91 ('plot_files', 'plots')]),92 ])93 94 return preprocess95 96 def preprocessing(self, flow, func_dic):97 from preprocessing.functions import function_str, decision98 self.coregistration(flow, func_dic)99 100 extract = Node(ExtractROI(t_size=-1, output_type='NIFTI_GZ'), name='extract')101 mcflirt = Node(MCFLIRT(save_plots=True, output_type='NIFTI_GZ'), name='mcflirt')102 103 slicetimer = Node(SliceTimer(index_dir=False, interleaved=True, output_type='NIFTI_GZ'), name='slicetimer')104 105 func_str, input_names = function_str('smooth', func_dic)106 Fsmooth = Node(Function(input_names=input_names,107 output_names=['smooth', 'files']), name='Fsmooth')108 Fsmooth.inputs.function_str = func_str109 110 decision = Node(Function(input_names=['mask', 'mc_mean', 'mc', 'st', 'slice_correct', 'mean_vol'],111 output_names=['start_img', 'corrected_img', 'mask'], function=decision), name='decision')112 decision.inputs.mean_vol = ''113 decision.inputs.st = ''114 115 art = Node(ArtifactDetect(norm_threshold=2,116 zintensity_threshold=3,117 mask_type='spm_global',118 parameter_source='FSL',119 use_differences=[True, False],120 plot_type='svg'),121 name="art")122 123 fillmask = Node(UnaryMaths(operation='fillh'), name='fillmask')124 125 func_str, input_names = function_str('regress', func_dic)126 Fregress = Node(Function(input_names=input_names,127 output_names=['warped', 'forreho']), name='Fregress', mem_gb=3)128 Fregress.inputs.function_str = func_str129 130 if 'rest' in self.task:131 Fregress.inputs.rest = True132 else:133 Fregress.inputs.rest = False134 135 flow.connect([(extract, mcflirt, [('roi_file', 'in_file')]),136 (mcflirt, slicetimer, [('out_file', 'in_file')]),137 (mcflirt, decision, [('mean_img', 'mean_vol'),138 ('out_file', 'mc')]),139 (mcflirt, art, [('par_file', 'realignment_parameters')]),140 (slicetimer, decision, [('slice_time_corrected_file', 'st')]),141 (decision, flow.get_node('Fregistration'), [('start_img', 'start_img'),142 ('corrected_img', 'corrected_img'),143 ('mask', 'brainmask')]),144 (decision, flow.get_node('Fmni'), [('mask', 'brainmask')]),145 (decision, flow.get_node('Fmni'), [('start_img', 'start_img')]),146 (flow.get_node('Fmni'), flow.get_node('boldmask'), [('start_img', 'inputnode.in_file')]),147 #(decision, flow.get_node('boldmask'), [('start_img', 'inputnode.in_file')]),148 (flow.get_node('boldmask'), fillmask, [('outputnode.skull_stripped_file', 'in_file')]),149 (flow.get_node('Fregistration'), art, [('warped', 'realigned_files')]),150 (flow.get_node('Fmni'), Fregress, [('warped', 'unsmoothed')]),151 (flow.get_node('Fmni'), Fregress, [('brainmask', 'mask')]),152 (flow.get_node('Fmni'), Fregress, [('segmentations', 'segmentations')]),153 #(art, Fregress, [('outlier_files', 'outliers')]),154 (mcflirt, Fregress, [('par_file', 'mc_par')]),155 (Fregress, Fsmooth, [('warped', 'warped')]),156 (fillmask, Fsmooth, [('out_file', 'mask')]),157 ])158 159 def coregistration(self, flow, func_dic):#SEARCH TO SEE IF BET ALREADY RUN AND OUTPUT SAVED160 from preprocessing.functions import function_str, strip_container161 from preprocessing.workflows import check4brains162 163 bet = Node(Function(input_names=['data_dir', 'T1w'], output_names='out_file', function=check4brains), name='bet') #init_brain_extraction_wf(name='bet')164 bet.inputs.data_dir = self.data_dir165 166 bet_strip = Node(Function(input_names='in_file', output_names='out_file', function=strip_container), name='bet_strip')...

Full Screen

Full Screen

graphs.py

Source:graphs.py Github

copy

Full Screen

1import networkx as nx2import matplotlib.pyplot as plt3G = nx.DiGraph()4n = 85def get_node(num_we, num_wf):6 return str(num_we) + 'WE_' + str(num_wf) + 'WF'7def get_brg_1():8 G.add_nodes_from([str(k) + 'WE_' + str(n - k) + 'WF' for k in range(0, n + 1)])9 G.add_edge(get_node(0, 8), get_node(1, 7))10 G.add_edge(get_node(1, 7), get_node(2, 6))11 G.add_edge(get_node(2, 6), get_node(3, 5))12 G.add_edge(get_node(3, 5), get_node(2, 6))13 G.add_edge(get_node(4, 4), get_node(3, 5))14 G.add_edge(get_node(4, 4), get_node(5, 3))15 G.add_edge(get_node(5, 3), get_node(6, 2))16 G.add_edge(get_node(7, 1), get_node(6, 2))17 G.add_edge(get_node(8, 0), get_node(7, 1))18 pos = nx.circular_layout(G)19 nx.draw(G, pos, node_size=3400, with_labels=True, font_color='w')20 nx.draw_networkx_nodes(G, pos, nodelist=[get_node(0, 8), get_node(1, 7), get_node(4, 4), get_node(5, 3), get_node(7, 1), get_node(8, 0)], node_color='b', node_size=3400)21 nx.draw_networkx_nodes(G, pos, nodelist=[get_node(2, 6), get_node(3, 5), get_node(6, 2)], node_color='b', node_size=3400, alpha=0.25)22 plt.show()23def get_brg_2():24 G.add_nodes_from([str(k) + 'WE_' + str(n - k) + 'WF' for k in range(0, n + 1)])25 G.add_edge(get_node(0, 8), get_node(1, 7))26 G.add_edge(get_node(1, 7), get_node(2, 6))27 G.add_edge(get_node(2, 6), get_node(3, 5))28 G.add_edge(get_node(3, 5), get_node(4, 4))29 G.add_edge(get_node(4, 4), get_node(5, 3))30 G.add_edge(get_node(5, 3), get_node(6, 2))31 G.add_edge(get_node(6, 2), get_node(7, 1))32 G.add_edge(get_node(7, 1), get_node(8, 0))33 pos = nx.circular_layout(G)34 nx.draw(G, pos, node_size=3400, with_labels=True, font_color='w')35 nx.draw_networkx_nodes(G, pos, nodelist=[get_node(0, 8),36 get_node(1, 7),37 get_node(2, 6),38 get_node(3, 5),39 get_node(4, 4),40 get_node(5, 3),41 get_node(6, 2),42 get_node(7, 1)], node_color='b', node_size=3400)43 nx.draw_networkx_nodes(G, pos, nodelist=[get_node(8, 0)], node_color='b', node_size=3400, alpha=0.25)44 plt.show()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful