upd
This commit is contained in:
		
							parent
							
								
									12bb1b792f
								
							
						
					
					
						commit
						115eb8cd8e
					
				
					 2 changed files with 33 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
__version__ = '0.1.6.5'
 | 
			
		||||
__version__ = '0.1.6.6'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								labsw/io.py
									
										
									
									
									
								
							
							
						
						
									
										32
									
								
								labsw/io.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -4,6 +4,7 @@ import yaml
 | 
			
		|||
import gzip
 | 
			
		||||
 | 
			
		||||
import os.path
 | 
			
		||||
import glob
 | 
			
		||||
 | 
			
		||||
from scipy.signal import savgol_filter
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -73,3 +74,34 @@ def load_metadata(filepath):
 | 
			
		|||
    with open(filepath, 'r') as stream:
 | 
			
		||||
        metadata = yaml.safe_load(stream)
 | 
			
		||||
    return metadata
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_exp_list(directory):
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    data = []
 | 
			
		||||
    for exp_dir in sorted(glob.glob(os.path.join(directory, '*'))):
 | 
			
		||||
        date = os.path.split(exp_dir)[1].split('-', maxsplit=1)[1].split('_')[0]
 | 
			
		||||
        data_filename = glob.glob(os.path.join(exp_dir, '*.dat.gz'))[0]
 | 
			
		||||
        meta_filename = glob.glob(os.path.join(exp_dir, '*yml'))[0]
 | 
			
		||||
 | 
			
		||||
        metadata = load_metadata(meta_filename)
 | 
			
		||||
        metadata['date'] = date
 | 
			
		||||
        metadata['path'] = exp_dir
 | 
			
		||||
        data.append(metadata)
 | 
			
		||||
 | 
			
		||||
    flattened_data = []
 | 
			
		||||
    for line in data:
 | 
			
		||||
        flattened_data.append({
 | 
			
		||||
            'Date': line['date'],
 | 
			
		||||
            'Experiment': line['exp'],
 | 
			
		||||
            'Sample Type': line['sample']['type'],
 | 
			
		||||
            'Width': line['sample']['width'],
 | 
			
		||||
            'Thickness': line['sample']['thickness'],
 | 
			
		||||
            'Length': line['sample']['length'],
 | 
			
		||||
            'Comment': line['comment'],
 | 
			
		||||
            'Path': line['path'],
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
    return pd.DataFrame(flattened_data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue