LemurPwned / VISM

Software for visualising magnetic layers
Other
6 stars 2 forks source link

Invalid state change on iteration #57

Closed LemurPwned closed 6 years ago

LemurPwned commented 6 years ago

I've noticed that it's not always the case (rather a coincidence) that the number of .omf/.ovf files matches the stage entries in .odt files. The stage names are noted in filename and must then match those in .odt files. This is standard todo: probably will require a little reworking of iteration mechanics

LemurPwned commented 6 years ago

As it seems only IdiotenProof solution is to do smth like this

number_of_files = len(files_in_directory_with_extension)
odt_stages = len(odt_column)
if number_of_files < odt_stages:
  file_skip = odt_stages/number_of_files
else:
 file_skip = 0
LemurPwned commented 6 years ago

What exactly is happening can be found in multiprocessing_parse.py

if odt_file is not None:
     odt_data, _ = getOdtData(odt_file[0]) <--- here the second arguments is stages
### stages in odt_data > number of files in directory
else:
     odt_data = None
stages = glob.glob(os.path.join(directory, '*' + ext)) 
test_file = os.path.join(directory, stages[0])

stages = len(stages) <--- stages are overwritten and match number of files

This is done now so that it does not cause an error. What should happen, is we can take


odt_data, stages1 = getOdtData(odt_file[0]) <----- here the second arguments is stages
 ...
stages = len(stages)
stages_skip = int(stages1/stages)
pawelkulig1 commented 6 years ago

Not argument, but returned value? Yes, but using getOdtData(), requires path to odt file, if it doesn't exist, we can't prove it. It requires changes in getOdtData function to handle None path or something like this.

LemurPwned commented 6 years ago

If no path then stages should be as they are right now

no returned value, it is unused right now