diff --git a/conda/meta.yaml b/conda/meta.yaml index e45b5a3..3e3ca95 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,6 +1,6 @@ package: name: sprit - version: 0.1.34 + version: 0.1.35 source: git_url: https://github.com/RJbalikian/SPRIT-HVSR @@ -23,7 +23,7 @@ requirements: - matplotlib - pandas - numpy - - pyqt5 + - PyQt5 - pyproj about: diff --git a/docs/generate_docs.py b/docs/generate_docs.py index 09559be..43b7942 100644 --- a/docs/generate_docs.py +++ b/docs/generate_docs.py @@ -8,12 +8,11 @@ #Whether to convert_md using markdown library (True), or let github do it (False) convert_md=True rtd_theme=False #Not currently working -release_version= '0.1.34' +release_version= '0.1.35' currentDir = pathlib.Path((__file__)).parent docsDir = currentDir repoDir = docsDir.parent -print(repoDir) spritDir = repoDir.joinpath('sprit') spritGUIPath = spritDir.joinpath('sprit_gui.py') spritUtilsPath = spritDir.joinpath('sprit_utils.py') diff --git a/docs/main.html b/docs/main.html index d214f2f..2e6cd1a 100644 --- a/docs/main.html +++ b/docs/main.html @@ -1729,7 +1729,7 @@

Parameters

combined_csvReport = pd.DataFrame() for site_name in hvsr_results.keys(): - if 'CSV_Report' in hvsr_results[site_name]: + if 'CSV_Report' in hvsr_results[site_name].keys(): combined_csvReport = pd.concat([combined_csvReport, hvsr_results[site_name]['CSV_Report']], ignore_index=True, join='inner') if export_path is not None: @@ -1744,7 +1744,7 @@

Parameters

else: csvExportPath = csvExportPath.parent - combined_csvReport.to_csv(csvExportPath, index=False) + combined_csvReport.to_csv(csvExportPath, index=False) if return_results: return hvsr_results @@ -3289,12 +3289,23 @@

Raises

data_noiseRemoved = remove_noise(hvsr_data=dataIN, verbose=verbose,**remove_noise_kwargs) except: data_noiseRemoved = dataIN - data_noiseRemoved['ProcessingStatus']['RemoveNoiseStatus']=False - #Since noise removal is not required for data processing, check others first - if dataIN['ProcessingStatus']['OverallStatus']: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = True - else: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = False + + #Reformat data so HVSRData and HVSRBatch data both work here + if isinstance(data_noiseRemoved, HVSRData): + data_noiseRemoved = {'place_holder_sitename':data_noiseRemoved} + dataIN = {'place_holder_sitename':dataIN} + + for site_name in data_noiseRemoved.keys(): + data_noiseRemoved[site_name]['ProcessingStatus']['RemoveNoiseStatus']=False + #Since noise removal is not required for data processing, check others first + if dataIN[site_name]['ProcessingStatus']['OverallStatus']: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = True + else: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not data_noiseRemoved[site_name]['batch']: + data_noiseRemoved = data_noiseRemoved[site_name] #Generate PPSDs try: @@ -3310,9 +3321,18 @@

Raises

else: errMsg = e raise RuntimeError(f"generate_ppsds() error: {errMsg}") + #Reformat data so HVSRData and HVSRBatch data both work here ppsd_data = data_noiseRemoved - ppsd_data['ProcessingStatus']['PPSDStatus']=False - ppsd_data['ProcessingStatus']['OverallStatus'] = False + if isinstance(ppsd_data, HVSRData): + ppsd_data = {'place_holder_sitename':ppsd_data} + + for site_name in ppsd_data.keys(): #This should work more or less the same for batch and regular data now + ppsd_data[site_name]['ProcessingStatus']['PPSDStatus']=False + ppsd_data[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not ppsd_data[site_name]['batch']: + ppsd_data = ppsd_data[site_name] #Process HVSR Curves try: @@ -3320,8 +3340,18 @@

Raises

hvsr_results = process_hvsr(params=ppsd_data, verbose=verbose,**process_hvsr_kwargs) except: hvsr_results = ppsd_data - hvsr_results['ProcessingStatus']['HVStatus']=False - hvsr_results['ProcessingStatus']['OverallStatus'] = False + if isinstance(hvsr_results, HVSRData): + hvsr_results = {'place_holder_sitename':hvsr_results} + + for site_name in hvsr_results.keys(): #This should work more or less the same for batch and regular data now + + hvsr_results[site_name]['ProcessingStatus']['HVStatus']=False + hvsr_results[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not hvsr_results[site_name]['batch']: + hvsr_results = hvsr_results[site_name] + #Final post-processing/reporting #Check peaks diff --git a/docs/sprit_hvsr.html b/docs/sprit_hvsr.html index a68c7b7..a37aa6d 100644 --- a/docs/sprit_hvsr.html +++ b/docs/sprit_hvsr.html @@ -445,12 +445,23 @@

Module sprit.sprit_hvsr

data_noiseRemoved = remove_noise(hvsr_data=dataIN, verbose=verbose,**remove_noise_kwargs) except: data_noiseRemoved = dataIN - data_noiseRemoved['ProcessingStatus']['RemoveNoiseStatus']=False - #Since noise removal is not required for data processing, check others first - if dataIN['ProcessingStatus']['OverallStatus']: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = True - else: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = False + + #Reformat data so HVSRData and HVSRBatch data both work here + if isinstance(data_noiseRemoved, HVSRData): + data_noiseRemoved = {'place_holder_sitename':data_noiseRemoved} + dataIN = {'place_holder_sitename':dataIN} + + for site_name in data_noiseRemoved.keys(): + data_noiseRemoved[site_name]['ProcessingStatus']['RemoveNoiseStatus']=False + #Since noise removal is not required for data processing, check others first + if dataIN[site_name]['ProcessingStatus']['OverallStatus']: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = True + else: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not data_noiseRemoved[site_name]['batch']: + data_noiseRemoved = data_noiseRemoved[site_name] #Generate PPSDs try: @@ -466,9 +477,18 @@

Module sprit.sprit_hvsr

else: errMsg = e raise RuntimeError(f"generate_ppsds() error: {errMsg}") + #Reformat data so HVSRData and HVSRBatch data both work here ppsd_data = data_noiseRemoved - ppsd_data['ProcessingStatus']['PPSDStatus']=False - ppsd_data['ProcessingStatus']['OverallStatus'] = False + if isinstance(ppsd_data, HVSRData): + ppsd_data = {'place_holder_sitename':ppsd_data} + + for site_name in ppsd_data.keys(): #This should work more or less the same for batch and regular data now + ppsd_data[site_name]['ProcessingStatus']['PPSDStatus']=False + ppsd_data[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not ppsd_data[site_name]['batch']: + ppsd_data = ppsd_data[site_name] #Process HVSR Curves try: @@ -476,8 +496,18 @@

Module sprit.sprit_hvsr

hvsr_results = process_hvsr(params=ppsd_data, verbose=verbose,**process_hvsr_kwargs) except: hvsr_results = ppsd_data - hvsr_results['ProcessingStatus']['HVStatus']=False - hvsr_results['ProcessingStatus']['OverallStatus'] = False + if isinstance(hvsr_results, HVSRData): + hvsr_results = {'place_holder_sitename':hvsr_results} + + for site_name in hvsr_results.keys(): #This should work more or less the same for batch and regular data now + + hvsr_results[site_name]['ProcessingStatus']['HVStatus']=False + hvsr_results[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not hvsr_results[site_name]['batch']: + hvsr_results = hvsr_results[site_name] + #Final post-processing/reporting #Check peaks @@ -1315,7 +1345,7 @@

Module sprit.sprit_hvsr

combined_csvReport = pd.DataFrame() for site_name in hvsr_results.keys(): - if 'CSV_Report' in hvsr_results[site_name]: + if 'CSV_Report' in hvsr_results[site_name].keys(): combined_csvReport = pd.concat([combined_csvReport, hvsr_results[site_name]['CSV_Report']], ignore_index=True, join='inner') if export_path is not None: @@ -1330,7 +1360,7 @@

Module sprit.sprit_hvsr

else: csvExportPath = csvExportPath.parent - combined_csvReport.to_csv(csvExportPath, index=False) + combined_csvReport.to_csv(csvExportPath, index=False) if return_results: return hvsr_results @@ -6900,7 +6930,7 @@

Parameters

combined_csvReport = pd.DataFrame() for site_name in hvsr_results.keys(): - if 'CSV_Report' in hvsr_results[site_name]: + if 'CSV_Report' in hvsr_results[site_name].keys(): combined_csvReport = pd.concat([combined_csvReport, hvsr_results[site_name]['CSV_Report']], ignore_index=True, join='inner') if export_path is not None: @@ -6915,7 +6945,7 @@

Parameters

else: csvExportPath = csvExportPath.parent - combined_csvReport.to_csv(csvExportPath, index=False) + combined_csvReport.to_csv(csvExportPath, index=False) if return_results: return hvsr_results @@ -8548,12 +8578,23 @@

Raises

data_noiseRemoved = remove_noise(hvsr_data=dataIN, verbose=verbose,**remove_noise_kwargs) except: data_noiseRemoved = dataIN - data_noiseRemoved['ProcessingStatus']['RemoveNoiseStatus']=False - #Since noise removal is not required for data processing, check others first - if dataIN['ProcessingStatus']['OverallStatus']: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = True - else: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = False + + #Reformat data so HVSRData and HVSRBatch data both work here + if isinstance(data_noiseRemoved, HVSRData): + data_noiseRemoved = {'place_holder_sitename':data_noiseRemoved} + dataIN = {'place_holder_sitename':dataIN} + + for site_name in data_noiseRemoved.keys(): + data_noiseRemoved[site_name]['ProcessingStatus']['RemoveNoiseStatus']=False + #Since noise removal is not required for data processing, check others first + if dataIN[site_name]['ProcessingStatus']['OverallStatus']: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = True + else: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not data_noiseRemoved[site_name]['batch']: + data_noiseRemoved = data_noiseRemoved[site_name] #Generate PPSDs try: @@ -8569,9 +8610,18 @@

Raises

else: errMsg = e raise RuntimeError(f"generate_ppsds() error: {errMsg}") + #Reformat data so HVSRData and HVSRBatch data both work here ppsd_data = data_noiseRemoved - ppsd_data['ProcessingStatus']['PPSDStatus']=False - ppsd_data['ProcessingStatus']['OverallStatus'] = False + if isinstance(ppsd_data, HVSRData): + ppsd_data = {'place_holder_sitename':ppsd_data} + + for site_name in ppsd_data.keys(): #This should work more or less the same for batch and regular data now + ppsd_data[site_name]['ProcessingStatus']['PPSDStatus']=False + ppsd_data[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not ppsd_data[site_name]['batch']: + ppsd_data = ppsd_data[site_name] #Process HVSR Curves try: @@ -8579,8 +8629,18 @@

Raises

hvsr_results = process_hvsr(params=ppsd_data, verbose=verbose,**process_hvsr_kwargs) except: hvsr_results = ppsd_data - hvsr_results['ProcessingStatus']['HVStatus']=False - hvsr_results['ProcessingStatus']['OverallStatus'] = False + if isinstance(hvsr_results, HVSRData): + hvsr_results = {'place_holder_sitename':hvsr_results} + + for site_name in hvsr_results.keys(): #This should work more or less the same for batch and regular data now + + hvsr_results[site_name]['ProcessingStatus']['HVStatus']=False + hvsr_results[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not hvsr_results[site_name]['batch']: + hvsr_results = hvsr_results[site_name] + #Final post-processing/reporting #Check peaks diff --git a/pyproject.toml b/pyproject.toml index 72c7a5c..2c8861e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "sprit" dynamic = ["readme"] license = {file = "LICENSE"} -version="0.1.34" +version="0.1.35" description = "A package for processing and analyzing HVSR (Horizontal to Vertical Spectral Ratio) data" keywords = ["HVSR", "seismic", "horizontal to vertical spectral ratio", "obspy", 'geology', 'geophysics', 'geotechnical'] requires-python = ">=3.9" diff --git a/setup.py b/setup.py index a59ce3d..42ac491 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ name="sprit", author= "Riley Balikian", author_email = "balikian@illinois.edu", - version="0.1.34", + version="0.1.35", package_data={'sprit': ['resources/*', 'resources/themes/*', 'resources/themes/forest-dark/*', 'resources/themes/forest-light/*', 'resources/sample_data/*',]}, long_description_content_type="text/markdown", long_description=long_description, diff --git a/sprit/__pycache__/__init__.cpython-310.pyc b/sprit/__pycache__/__init__.cpython-310.pyc index 8ebbe7e..f1153d9 100644 Binary files a/sprit/__pycache__/__init__.cpython-310.pyc and b/sprit/__pycache__/__init__.cpython-310.pyc differ diff --git a/sprit/__pycache__/sprit_gui.cpython-310.pyc b/sprit/__pycache__/sprit_gui.cpython-310.pyc index fd987b9..80db163 100644 Binary files a/sprit/__pycache__/sprit_gui.cpython-310.pyc and b/sprit/__pycache__/sprit_gui.cpython-310.pyc differ diff --git a/sprit/__pycache__/sprit_hvsr.cpython-310.pyc b/sprit/__pycache__/sprit_hvsr.cpython-310.pyc index 3d951fc..980c8c8 100644 Binary files a/sprit/__pycache__/sprit_hvsr.cpython-310.pyc and b/sprit/__pycache__/sprit_hvsr.cpython-310.pyc differ diff --git a/sprit/__pycache__/sprit_hvsr.cpython-311.pyc b/sprit/__pycache__/sprit_hvsr.cpython-311.pyc index 674b2f5..5c1dcee 100644 Binary files a/sprit/__pycache__/sprit_hvsr.cpython-311.pyc and b/sprit/__pycache__/sprit_hvsr.cpython-311.pyc differ diff --git a/sprit/__pycache__/sprit_utils.cpython-310.pyc b/sprit/__pycache__/sprit_utils.cpython-310.pyc index 2dbc34c..c66b840 100644 Binary files a/sprit/__pycache__/sprit_utils.cpython-310.pyc and b/sprit/__pycache__/sprit_utils.cpython-310.pyc differ diff --git a/sprit/resources/sample_data/Batch_SampleData.csv b/sprit/resources/sample_data/Batch_SampleData.csv index 3a5ef04..a0ec9be 100644 --- a/sprit/resources/sample_data/Batch_SampleData.csv +++ b/sprit/resources/sample_data/Batch_SampleData.csv @@ -1,7 +1,7 @@ datapath,site,source,acq_date,starttime,endtime,tzone,xcoord,ycoord,elevation,input_crs SampleHVSRSite1_AM.RAC84.00.2023.046_2023-02-15_1704-1734.MSEED,SampleHVSRSite1,file,2/15/2023,17:04,17:34,UTC,-87.529,41.691,582.2,EPSG:4326 -SampleHVSRSite2_AM.RAC84.00.2023-02-15_2132-2200.MSEED,SampleHVSRSite2,file,2/15/2023,16:32,17:00,US/Central,-87.53764,41.6695,584.9,EPSG:4326 +SampleHVSRSite2_AM.RAC84.00.2023-02-15_2132-2200.MSEED,SampleHVSRSite2,file,2/15/2023,15:32,16:00,US/Central,-87.53764,41.6695,584.9,EPSG:4326 SampleHVSRSite3_AM.RAC84.00.2023.199_2023-07-18_1432-1455.MSEED,SampleHVSRSite3,file,7/18/2023,14:32,14:55,UTC,,,, SampleHVSRSite4_AM.RAC84.00.2023.199_2023-07-18_1609-1629.MSEED,SampleHVSRSite4,file,7/18/2023,16:09,16:29,UTC,,,, SampleHVSRSite5_AM.RAC84.00.2023.199_2023-07-18_2039-2100.MSEED,SampleHVSRSite5,file,7/18/2023,16:39,17:00,US/Eastern,,,, -SampleHVSRSite6_AM.RAC84.00.2023.192_2023-07-11_1510-1528.MSEED,SampleHVSRSite6,file,7/11/2023,15:10,15:28,UTC,,,, +SampleHVSRSite6_AM.RAC84.00.2023.192_2023-07-11_1510-1528.MSEED,SampleHVSRSite6,file,7/11/2023,15:10,15:28,UTC,,,, \ No newline at end of file diff --git a/sprit/sprit_hvsr.py b/sprit/sprit_hvsr.py index 4014f90..dc7a4ed 100644 --- a/sprit/sprit_hvsr.py +++ b/sprit/sprit_hvsr.py @@ -414,12 +414,23 @@ def run(datapath, source='file', verbose=False, **kwargs): data_noiseRemoved = remove_noise(hvsr_data=dataIN, verbose=verbose,**remove_noise_kwargs) except: data_noiseRemoved = dataIN - data_noiseRemoved['ProcessingStatus']['RemoveNoiseStatus']=False - #Since noise removal is not required for data processing, check others first - if dataIN['ProcessingStatus']['OverallStatus']: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = True - else: - data_noiseRemoved['ProcessingStatus']['OverallStatus'] = False + + #Reformat data so HVSRData and HVSRBatch data both work here + if isinstance(data_noiseRemoved, HVSRData): + data_noiseRemoved = {'place_holder_sitename':data_noiseRemoved} + dataIN = {'place_holder_sitename':dataIN} + + for site_name in data_noiseRemoved.keys(): + data_noiseRemoved[site_name]['ProcessingStatus']['RemoveNoiseStatus']=False + #Since noise removal is not required for data processing, check others first + if dataIN[site_name]['ProcessingStatus']['OverallStatus']: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = True + else: + data_noiseRemoved[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not data_noiseRemoved[site_name]['batch']: + data_noiseRemoved = data_noiseRemoved[site_name] #Generate PPSDs try: @@ -435,9 +446,18 @@ def run(datapath, source='file', verbose=False, **kwargs): else: errMsg = e raise RuntimeError(f"generate_ppsds() error: {errMsg}") + #Reformat data so HVSRData and HVSRBatch data both work here ppsd_data = data_noiseRemoved - ppsd_data['ProcessingStatus']['PPSDStatus']=False - ppsd_data['ProcessingStatus']['OverallStatus'] = False + if isinstance(ppsd_data, HVSRData): + ppsd_data = {'place_holder_sitename':ppsd_data} + + for site_name in ppsd_data.keys(): #This should work more or less the same for batch and regular data now + ppsd_data[site_name]['ProcessingStatus']['PPSDStatus']=False + ppsd_data[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not ppsd_data[site_name]['batch']: + ppsd_data = ppsd_data[site_name] #Process HVSR Curves try: @@ -445,8 +465,18 @@ def run(datapath, source='file', verbose=False, **kwargs): hvsr_results = process_hvsr(params=ppsd_data, verbose=verbose,**process_hvsr_kwargs) except: hvsr_results = ppsd_data - hvsr_results['ProcessingStatus']['HVStatus']=False - hvsr_results['ProcessingStatus']['OverallStatus'] = False + if isinstance(hvsr_results, HVSRData): + hvsr_results = {'place_holder_sitename':hvsr_results} + + for site_name in hvsr_results.keys(): #This should work more or less the same for batch and regular data now + + hvsr_results[site_name]['ProcessingStatus']['HVStatus']=False + hvsr_results[site_name]['ProcessingStatus']['OverallStatus'] = False + + #If it wasn't originally HVSRBatch, make it HVSRData object again + if not hvsr_results[site_name]['batch']: + hvsr_results = hvsr_results[site_name] + #Final post-processing/reporting #Check peaks @@ -1284,7 +1314,7 @@ def get_report(hvsr_results, report_format='print', plot_type='HVSR p ann C+ p a combined_csvReport = pd.DataFrame() for site_name in hvsr_results.keys(): - if 'CSV_Report' in hvsr_results[site_name]: + if 'CSV_Report' in hvsr_results[site_name].keys(): combined_csvReport = pd.concat([combined_csvReport, hvsr_results[site_name]['CSV_Report']], ignore_index=True, join='inner') if export_path is not None: @@ -1299,7 +1329,7 @@ def get_report(hvsr_results, report_format='print', plot_type='HVSR p ann C+ p a else: csvExportPath = csvExportPath.parent - combined_csvReport.to_csv(csvExportPath, index=False) + combined_csvReport.to_csv(csvExportPath, index=False) if return_results: return hvsr_results