Skip to content

Instantly share code, notes, and snippets.

View thorstenwagner's full-sized avatar

Thorsten Wagner thorstenwagner

View GitHub Profile
@thorstenwagner
thorstenwagner / example_cinderella.py
Created October 17, 2019 08:51
Example cinderella
from Auto2DSelect.auto_2d_select import Auto2DSelectNet # Import cinderella
from Auto2DSelect import results_writer # Import writer
batch_size =4 # If you have memory problems, choose a smaller one
input_path = "path/to/classes.hdf" # path to your classes
weights_path = "path/to/weights.h5" # path to your trained model
# You can read the input size from the trained model or just set it to size used during training.
with h5py.File(weights_path, mode="r") as f:
try:
@thorstenwagner
thorstenwagner / bla.py
Created November 14, 2019 15:15
blablub
#!/usr/bin/python
###This script is to convert the xml file after picking to .coords files (txt).
###It can take the rotation applied before picking.
###It will also split the coordinates based on boundary line drawn during picking.
import argparse
import numpy as np
import subprocess
import os
Dear SPHIRE users!
we would like to inform you about the release of crYOLO 1.7.5! It fixes several bugs:
Fixed a problem where the training was not working if no filter (like Low pass or JANNI ) was used. (Thanks to Andrea Nans)
The config file value max_box_per_image is now adapted automatically to the given training data. If this value was lower than the number of labeled particles per micrograph, not all particle were taken into account during training. The automatic adaption ensures that it is high enough.
Fixed a crash of crYOLO when no particles were picked. (Thanks to Grigory Sharov)
def filter_single_image(img_path, filter_cutoff, resize_to_shape=None):
try:
image = imagereader.image_read(img_path)
except Exception:
print(img_path + " is corrupted. Ignore it.")
return None
return filter_single_image_np(image,filter_cutoff,resize_to_shape)
def filter_single_image_np(image, filter_cutoff, resize_to_shape=None):
@thorstenwagner
thorstenwagner / change.py
Last active February 23, 2021 08:12
isac_changes
--- a/sphire/sphire/bin/sp_gui.py
+++ b/sphire/sphire/bin/sp_gui.py
@@ -3093,7 +3093,10 @@ class SXCmdTab(QWidget):
self.qsub_script_edit = QLineEdit()
if self.sxcmdwidget.sxcmd.is_submittable == True:
- if 'SPHIRE_SUBMISSION_SCRIPT_TEMPLATE' in os.environ:
+ if 'SPHIRE_SUBMISSION_SCRIPT_TEMPLATE_GPU' in os.environ and \
+ self.sxcmdwidget.sxcmd.name in ('sp_isac2_gpu', ):
+ submission_script_template = os.environ['SPHIRE_SUBMISSION_SCRIPT_TEMPLATE_GPU']
@thorstenwagner
thorstenwagner / map_array_alternative.py
Last active December 8, 2023 22:43
fast map array alternative
import numpy as np
from skimage.util import map_array
from time import perf_counter
from skimage.util import map_array
shape = (50,1024,1024)
total = shape[0]*shape[1]*shape[2]
NUM_LABELS=total*2
input_data = np.random.randint(NUM_LABELS,size=total).reshape(shape).astype("int64")
from_values = np.arange(NUM_LABELS)