Commit ca10567b authored by Josef Brandt's avatar Josef Brandt

Important bugfixes

parents fc238b30 de30ddf1
......@@ -5,7 +5,7 @@ sys.path.append("C://Users//xbrjos//Desktop//Python")
from gepard import dataset
from gepard.analysis.particleContainer import ParticleContainer
from cythonModules import rotateContour
from helpers import get_filterDimensions_from_dataset, get_center_from_filter_dimensions
from helpers import get_filterDimensions_from_dataset, get_center_from_filter_dimensions, convert_length_to_pixels
class ParticleVariations(object):
......@@ -18,9 +18,12 @@ class ParticleVariations(object):
def get_particleContainer_variations(self) -> ParticleContainer:
if self.numVariations > 0:
offset, diameter, [width, height] = get_filterDimensions_from_dataset(self.dataset)
diameter: float = convert_length_to_pixels(self.dataset, diameter)
offset: tuple = convert_length_to_pixels(self.dataset, offset[0]), \
convert_length_to_pixels(self.dataset, offset[1])
center: np.ndarray = get_center_from_filter_dimensions(offset, diameter)
partContainer: ParticleContainer = self.origParticleContainer
# contours: list = partContainer.getParticleContours()
angles = self._get_angles()
for i in range(self.numVariations):
if i > 0:
......
......@@ -32,7 +32,8 @@ def get_methods_to_test(dataset: dataset.DataSet, fractions: list = []) -> list:
:return: list of measurement Objects that are applicable
"""
if len(fractions) == 0:
fractions: list = [0.02, 0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 0.9]
fractions: list = [0.02, 0.05, 0.1, 0.25, 0.5, 0.7, 0.9]
# fractions: list = [0.02, 0.1, 0.5, 0.9]
methods: list = []
particleContainer = dataset.particleContainer
......@@ -199,10 +200,6 @@ class SubsamplingResult(object):
:param subParticles:
:return:
"""
# if type(self.method) == cmeth.ChemometricSubsampling:
# print('chemometric subsamling found')
# error: float = self._get_mp_count_error(origParticles, subParticles, 1.0)
# else:
error: float = self._get_mp_count_error(origParticles, subParticles, self.method.fraction)
self.origParticleCount = len(origParticles)
self.mpCountErrors.append(error)
......@@ -247,7 +244,7 @@ class SampleResult(object):
"""
An object the stores all generated results per sample and can update and report on them.
"""
def __init__(self, filepath: str, numVariations: int = 10):
def __init__(self, filepath: str, numVariations: int = 5):
super(SampleResult, self).__init__()
self.filepath: str = filepath
self.dataset: dataset.DataSet = None
......
......@@ -11,7 +11,7 @@ def get_error_vs_frac_plot(totalResults: TotalResults, attributes: list = [], me
methods = [[]]*len(attributes)
assert len(attributes) == len(methods)
fig: Figure = plt.figure()
fig: Figure = plt.figure(figsize=(10, 5))
numRows: int = 1
numCols: int = 1
if len(attributes) == 0:
......@@ -48,6 +48,8 @@ def get_error_vs_frac_plot(totalResults: TotalResults, attributes: list = [], me
ax.legend()
index += 1
fig.tight_layout()
return fig
......
......@@ -12,8 +12,7 @@ SET GEPARD TO EVALUATION BRANCH (WITHOUT THE TILING STUFF), OTHERWISE SOME OF TH
"""
if __name__ == '__main__':
# results: TotalResults = TotalResults()
results: TotalResults = load_results('results1.res')
results: TotalResults = TotalResults()
pklsInFolders = get_pkls_from_directory(r'C:\Users\xbrjos\Desktop\temp MP\NewDatasets')
for folder in pklsInFolders.keys():
......@@ -26,9 +25,14 @@ if __name__ == '__main__':
results.update_all()
print('updating all took', time.time()-t0, 'seconds')
save_results('results1.res', results)
results: TotalResults = load_results('results1.res')
save_results('results2.res', results)
# results: TotalResults = load_results('results1.res')
plot: Figure = get_error_vs_frac_plot(results, attributes=[['air', 'water'], ['sediment', 'soil', 'beach', 'slush']],
methods=[])
# plot: Figure = get_error_vs_frac_plot(results, attributes=[['air', 'water'], ['sediment', 'soil', 'beach', 'slush']],
# methods=[['Boxes random']]*2)
# methods=[['Random Subsampling', 'Sizebin']] * 2)
plot: Figure = get_error_vs_frac_plot(results,
attributes=[['air', 'water'], ['sediment', 'soil', 'beach', 'slush']],
methods=[['layout (7', 'layout (10', 'layout (15', 'cross', 'random subsampling', 'sizebin']] * 2)
plot.show()
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment