diff --git a/cosipy/data_io/ReadTraTest.py b/cosipy/data_io/ReadTraTest.py index 5fbaa94b..681049e1 100644 --- a/cosipy/data_io/ReadTraTest.py +++ b/cosipy/data_io/ReadTraTest.py @@ -25,8 +25,6 @@ def read_tra_old(self,make_plots=True): """Reads in MEGAlib .tra (or .tra.gz) file. - Extended Summary - ---------------- This method uses MEGAlib to read events from the tra file. This is used to compare to the new event reader, which is independent of MEGAlib. @@ -41,17 +39,17 @@ def read_tra_old(self,make_plots=True): ------- cosi_dataset : dict Returns COSI dataset as a dictionary of the form: - cosi_dataset = {'Full filename':self.data_file, - 'Energies':erg, - 'TimeTags':tt, - 'Xpointings':np.array([lonX,latX]).T, - 'Ypointings':np.array([lonY,latY]).T, - 'Zpointings':np.array([lonZ,latZ]).T, - 'Phi':phi, - 'Chi local':chi_loc, - 'Psi local':psi_loc, - 'Distance':dist, - 'Chi galactic':chi_gal, + cosi_dataset = {'Full filename':self.data_file,\ + 'Energies':erg,\ + 'TimeTags':tt,\ + 'Xpointings':np.array([lonX,latX]).T,\ + 'Ypointings':np.array([lonY,latY]).T,\ + 'Zpointings':np.array([lonZ,latZ]).T,\ + 'Phi':phi,\ + 'Chi local':chi_loc,\ + 'Psi local':psi_loc,\ + 'Distance':dist,\ + 'Chi galactic':chi_gal,\ 'Psi galactic':psi_gal} Note diff --git a/cosipy/data_io/UnBinnedData.py b/cosipy/data_io/UnBinnedData.py index 1632a229..1a32ed46 100644 --- a/cosipy/data_io/UnBinnedData.py +++ b/cosipy/data_io/UnBinnedData.py @@ -63,27 +63,27 @@ def read_tra(self, output_name=None, run_test=False, use_ori=False, cosi_dataset, dict The returned dictionary contains the COSI dataset, which has the form: - cosi_dataset = {'Energies':erg, - 'TimeTags':tt, - 'Xpointings':np.array([lonX,latX]).T, - 'Ypointings':np.array([lonY,latY]).T, - 'Zpointings':np.array([lonZ,latZ]).T, - 'Phi':phi, - 'Chi local':chi_loc, - 'Psi local':psi_loc, - 'Distance':dist, - 'Chi galactic':chi_gal, - 'Psi galactic':psi_gal} - Arrays contain unbinned photon data. + cosi_dataset = {'Energies':erg,\ + 'TimeTags':tt,\ + 'Xpointings':np.array([lonX,latX]).T,\ + 'Ypointings':np.array([lonY,latY]).T,\ + 'Zpointings':np.array([lonZ,latZ]).T,\ + 'Phi':phi,\ + 'Chi local':chi_loc,\ + 'Psi local':psi_loc,\ + 'Distance':dist,\ + 'Chi galactic':chi_gal,\ + 'Psi galactic':psi_gal}\ + Arrays contain unbinned photon data. Notes ----- - The current code is only able to handle data with Compton - events. It will need to be modified to handle single-site - and pair events. + The current code is only able to handle data with Compton + events. It will need to be modified to handle single-site + and pair events. - This method sets the instance attribute, cosi_dataset, - but it does not explicitly return this. + This method sets the instance attribute, cosi_dataset, + but it does not explicitly return this. """ start_time = time.time() @@ -376,8 +376,6 @@ def instrument_pointing(self): """Get pointing information from ori file. - Extended Summary - --------------- Initializes interpolated functions for lonx, latx, lonz, latz in radians. @@ -555,8 +553,8 @@ def get_dict_from_hdf5(self, input_hdf5): """Constructs dictionary from input hdf5 file - Parameter - --------- + Parameters + ---------- input_hdf5 : str Name of input hdf5 file. diff --git a/cosipy/spacecraftfile/SpacecraftFile.py b/cosipy/spacecraftfile/SpacecraftFile.py index 3b8ed1fb..877de567 100644 --- a/cosipy/spacecraftfile/SpacecraftFile.py +++ b/cosipy/spacecraftfile/SpacecraftFile.py @@ -445,7 +445,7 @@ def get_scatt_map(self, """ Bin the spacecraft attitude history into a 4D histogram that contains the accumulated time the axes of the spacecraft where looking at a given direction. - Paremeters + Parameters ---------- nside : int The nside of the scatt map. diff --git a/cosipy/util/data_fetching.py b/cosipy/util/data_fetching.py index bef3e66c..8823b894 100644 --- a/cosipy/util/data_fetching.py +++ b/cosipy/util/data_fetching.py @@ -1,5 +1,6 @@ import os from awscli.clidriver import create_clidriver +from pathlib import Path def fetch_wasabi_file(file, output = None, @@ -31,16 +32,19 @@ def fetch_wasabi_file(file, if output is None: output = file.split('/')[-1] - if os.path.exists(output) and not override: + output = Path(output) + + if output.exists() and not override: raise RuntimeError(f"File {output} already exists.") cli = create_clidriver() cli.session.set_credentials(access_key, secret_key) - - cli.main(['s3api', 'get-object', - '--bucket', bucket, - '--key', file, - '--endpoint-url', endpoint, - output]) + command = ['s3api', 'get-object', + '--bucket', bucket, + '--key', file, + '--endpoint-url', endpoint, + str(output)] + + cli.main(command) diff --git a/docs/conf.py b/docs/conf.py index 3d93c3f6..a8db9f71 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,6 +66,7 @@ 'pandas', 'tqdm', 'scipy', + 'psutil', 'awscli'] # There seems to be a conflict between unittest.mock (used by sphinx) and metaclasses