Completing OFRAnalyser creator, starting on OFRSample creator and mass integrator
This commit is contained in:
1 parent
3a05808e14
commit
8dd5a497be
3 files changed
+67
-21
No files matched your search
Vendored
+12
-1
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"chat.disableAIFeatures": true,
|
||||
"chat.agent.enabled": false,
|
||||
"chat.commandCenter.enabled": false,
|
||||
"inlineChat.accessibleDiffView": "off",
|
||||
"terminal.integrated.initialHint": false,
|
||||
"chat.checkpoints.enabled": false,
|
||||
"chat.undoRequests.restoreInput": false,
|
||||
"chat.agent.sandbox.allowAutoApprove": false,
|
||||
@@ -35,5 +39,12 @@
|
||||
"python-envs.defaultEnvManager": "ms-python.python:conda",
|
||||
"python-envs.defaultPackageManager": "ms-python.python:conda",
|
||||
"python.envFile": "${workspaceFolder}/.env",
|
||||
"python.terminal.useEnvFile": true
|
||||
"python.terminal.useEnvFile": true,
|
||||
"editor.quickSuggestions": {
|
||||
"other": "off",
|
||||
"comments": "off",
|
||||
"strings": "off"
|
||||
},
|
||||
"editor.suggestOnTriggerCharacters": false,
|
||||
"window.zoomLevel": -1
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
### -------------------------------------------------------------------------------- ###
|
||||
### SCRAPYARD TO DEBUG AND TEST FUNCTIONALITY
|
||||
|
||||
import sys
|
||||
print(sys.path)
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from defs import OFRAnalyser, OFRSample
|
||||
|
||||
analyser = OFRAnalyser(sourcefile="/Volumes/5505/People/David_Tschan/data/OFR_SMPS/2026/processed/06_June/20260612/20260612_SET02_EXP01_full.csv")
|
||||
analyser = OFRAnalyser(sourcefile="Z:/People/David_Tschan/data/OFR_SMPS/2026/processed/06_June/20260612/20260612_SET02_EXP01_full.csv")
|
||||
samplelist = np.linspace(start=1, stop=analyser.max_samples, num=analyser.max_samples, dtype=int).tolist()
|
||||
|
||||
analyser.GetTotalMass(samples=samplelist, plot=True)
|
||||
|
||||
print("Hello")
|
||||
+48
-16
@@ -1,19 +1,38 @@
|
||||
### -------------------------------------------------------------------------------- ###
|
||||
### IMPORTS AND CONFIGURATIONS
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
### -------------------------------------------------------------------------------- ###
|
||||
### OFR ANALYSIS
|
||||
|
||||
class OFRSample:
|
||||
|
||||
def __init__(self, number, diameterlist, countlist):
|
||||
def __init__(self, number, sourcefile, headlines):
|
||||
|
||||
self.number = number
|
||||
self.diameterlist = diameterlist
|
||||
self.countlist = countlist
|
||||
self.samplelist = {}
|
||||
self.sourcefile = sourcefile
|
||||
self.headlines = headlines
|
||||
|
||||
self.diameters = np.empty(shape=(self.number, 1))
|
||||
self.counts = np.empty(shape=(self.number, 1))
|
||||
|
||||
def __get_data(self):
|
||||
|
||||
columns = ['Diameter #' + str(self.number), 'Counts #' + str(self.number)]
|
||||
sample_data = pd.read_csv(filepath_or_buffer=self.sourcefile, header=self.headlines, usecols=columns, index=False).to_numpy()
|
||||
|
||||
self.diameters = sample_data[:, 0]
|
||||
self.counts = sample_data[:, 1]
|
||||
|
||||
def mass_integrator(self, method='trapz') -> None:
|
||||
|
||||
self.__get_data()
|
||||
|
||||
|
||||
pass
|
||||
|
||||
class OFRAnalyser:
|
||||
|
||||
@@ -21,24 +40,37 @@ class OFRAnalyser:
|
||||
self.sourcefile = sourcefile
|
||||
self.headlines = headlines
|
||||
|
||||
head_row = pd.read_csv(filepath_or_buffer=self.sourcefile, header=self.headlines, nrows=1)
|
||||
self.__max_sample = None
|
||||
with open(self.sourcefile) as file:
|
||||
file_reader = csv.reader(file)
|
||||
for index, row in enumerate(file_reader):
|
||||
if index != self.headlines:
|
||||
continue
|
||||
else:
|
||||
head_row = row
|
||||
|
||||
def __get_samples(self) -> None:
|
||||
self.max_samples = int((len(head_row) - 1) / 2)
|
||||
|
||||
def __get_sample(self, sample_number) -> None:
|
||||
pass
|
||||
|
||||
def __samplelist_check(self, samplelist) -> None:
|
||||
def __sample_number_list_check(self, sample_number_list) -> None:
|
||||
|
||||
last_sample = samplelist[-1]
|
||||
last_sample = sample_number_list[-1]
|
||||
|
||||
if last_sample > self.__max_sample:
|
||||
raise IndexError("The last sample(s) go out of range of recorded samples")
|
||||
if last_sample > self.max_samples:
|
||||
raise IndexError("The last sample(s) are out of range of the number of recorded samples")
|
||||
|
||||
def __mass_integrator(self, samplelist) -> None:
|
||||
pass
|
||||
def GetTotalMass(self, samples = [1], plot = False) -> None:
|
||||
|
||||
def GetTotalMass(self, samples = 'all', plot = False) -> None:
|
||||
pass
|
||||
self.__sample_number_list_check(samples)
|
||||
masses = []
|
||||
|
||||
for sample in samples:
|
||||
local_sample = OFRSample(number=sample, sourcefile=self.sourcefile, headlines=self.headlines)
|
||||
mass = local_sample.mass_integrator()
|
||||
masses.append(mass)
|
||||
|
||||
|
||||
|
||||
def PlotSampleDistribution(self, sample) -> None:
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user