Skip to content

Commit f886f85

Browse files
committed
Big commit
1 parent 79fdb2c commit f886f85

10 files changed

+335
-303
lines changed

ATSSim.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main():
3333

3434
# Comment if only taking one stack
3535
allFiles = glob.glob('//lebnas1.epfl.ch/microsc125/iSIMstorage/Users/Willi/'
36-
'180420_drp_mito_Dora/**/*MMStack*_combine*.ome.tif', recursive=True)
36+
'180420_drp_mito_Dora/**/*MMStack*_combine.ome.tif', recursive=True)
3737

3838
# allFiles = glob.glob('W:/iSIMstorage/Users/Willi/160622_caulobacter/'
3939
# '160622_CB15N_WT/SIM images/Series*[0-9].ome.tif')
@@ -44,14 +44,16 @@ def main():
4444
# nnFile = file[:-8] + '_nn.ome.tif'
4545
sample = re.split('sample', file)[1][0]
4646
cell = re.split('cell_', file)[1][0]
47-
atsFolder = os.path.dirname(file) + '/s' + str(sample).zfill(2) + '_c' + str(cell).zfill(2) + '_ATS'
47+
atsFolder = (os.path.dirname(file) + '/s' + str(sample).zfill(2) + '_c' +
48+
str(cell).zfill(2) + '_ATS2')
4849

4950
# atsFolder = file[:-4] + '_ATS_ffmodel'
5051
# if not os.path.isfile(nnFile):
5152
if not os.path.isdir(atsFolder):
5253
stacks.append(file)
5354
stacks = sorted(stacks)
5455
print('\n'.join(stacks))
56+
stacks = ['C:/Users/stepp/Documents/02_Raw/SmartMito/sample1_cell_3.tif']
5557
atsOnStack(stacks)
5658

5759

@@ -63,7 +65,7 @@ def atsOnStack(stacks: list):
6365
# USER SETTINGS
6466
# see end of file for setting the folders/files to do the simulation on
6567
#
66-
modelPath = '//lebnas1.epfl.ch/microsc125/Watchdog/Model/model_Willi.h5'
68+
modelPath = '//lebnas1.epfl.ch/microsc125/Watchdog/Model/paramSweep5/f32_c07_b08.h5'
6769
# Should we get the settings from the central settings file?
6870
extSettings = False
6971
dataOrder = 0 # 0 for drp/foci first, 1 for mito/structure first
@@ -102,7 +104,8 @@ def atsOnStack(stacks: list):
102104
# newFolder = re.split(r'.tif', stack)[0] + '_ATS_ffmodel'
103105
sample = re.split('sample', stack)[1][0]
104106
cell = re.split('cell_', stack)[1][0]
105-
newFolder = os.path.dirname(stack) + '/s' + str(sample).zfill(2) + '_c' + str(cell).zfill(2) + '_ATS'
107+
newFolder = (os.path.dirname(stack) + '/s' + str(sample).zfill(2) + '_c' +
108+
str(cell).zfill(2) + '_ATS2')
106109
if os.path.exists(newFolder):
107110
shutil.rmtree(newFolder)
108111
os.mkdir(newFolder)
@@ -122,9 +125,16 @@ def atsOnStack(stacks: list):
122125

123126
# dataOrder = dataOrderMetadata(stack)
124127
dataOrder = dataOrderMetadata(stack, write=False)
125-
drpOrig, mitoOrig, drpTimes, mitoTimes = loadTifStack(stack, outputElapsed=True)
128+
drpOrig, mitoOrig, drpTimes, mitoTimes = loadTifStack(stack, order=dataOrder,
129+
outputElapsed=True)
126130
print('stack loaded')
127131

132+
# check if there is timing in the times or just frames and if adjust for timing in ms
133+
diff = np.diff(drpTimes)
134+
if np.max(diff) < 3:
135+
drpTimes = np.multiply(drpTimes, 500)
136+
mitoTimes = np.multiply(mitoTimes, 500)
137+
128138
time = drpTimes[0]
129139
frame = 0
130140
fastMode = False
@@ -278,7 +288,6 @@ def atsOnStack(stacks: list):
278288
print((' -> ' + str(frame)), end=' ')
279289
print(('fast frames:' + str(fastCount)), end='\r')
280290

281-
282291
if outputData[-1] == 0:
283292
fileHandle = open("ATSSim_logging.txt", "a")
284293
fileHandle.write('\n outputData was 0 at frame')
@@ -290,7 +299,5 @@ def atsOnStack(stacks: list):
290299
print('\ntotal fast frames: ', fastCum, '\n\n')
291300

292301

293-
294-
295302
if __name__ == '__main__':
296303
main()

FullFrameNN.py

-60
This file was deleted.

Mito2Drp1.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def prepareProc(threshold=150):
110110
plt.draw()
111111
plt.pause(1)
112112
output_data = output_data.reshape(output_data.shape[0], 128, 128, 1)
113-
hf = h5py.File('//lebnas1.epfl.ch/microsc125/Watchdog/Model/prep_data7.h5', 'a')
113+
hf = h5py.File('//lebnas1.epfl.ch/microsc125/Watchdog/Model/prep_data9.h5', 'a')
114114
try:
115115
del hf['Proc']
116116
except KeyError:
@@ -321,6 +321,8 @@ def makeModel(input_data, output_data, nb_filters=32, firstConvSize=5, batch_siz
321321
down1 = Activation('relu')(down1)
322322
down1_pool = MaxPooling2D((2, 2), strides=(2, 2))(down1)
323323

324+
# Down2 and Up2 are not really used in the moment, because they are skipped, as down1_pool
325+
# is used in the center layer as input and center is used in up1 as input, not up2
324326
down2 = Conv2D(nb_filters*2, (3, 3), padding='same')(down1_pool)
325327
down2 = BatchNormalization()(down2)
326328
down2 = Activation('relu')(down2)
@@ -516,7 +518,7 @@ def makeModel(input_data, output_data, nb_filters=32, firstConvSize=5, batch_siz
516518
def main():
517519
print('* Importing data *')
518520
data_path = '//lebnas1.epfl.ch/microsc125/Watchdog/Model/' # nb: begin with /
519-
collection = 'paramSweep6'
521+
collection = 'paramSweep9'
520522
data_filename = data_path + collection + '/prep_data' + collection[-1] + '.h5' # Mito
521523
hf = h5py.File(data_filename, 'r')
522524
input_data1 = hf.get('Mito')

0 commit comments

Comments
 (0)