Loading src/gui.py +11 −11 Original line number Diff line number Diff line Loading @@ -338,11 +338,11 @@ class Ui(QtWidgets.QMainWindow): c = 0 # Place group data in integer format: if self.has_groups: self.fileList.setItem(i, c, self.create_table_item(int(row['group']))) self.fileList.setItem(i, c, self.create_table_item(row['group'])) c += 1 # Place galaxy data in integer format: self.fileList.setItem(i, c, self.create_table_item(int(row['galaxy']))) self.fileList.setItem(i, c, self.create_table_item(row['galaxy'])) c += 1 # Set Icon in the row: self.fileList.setCellWidget(i, c, self.getIconCell(row['processed'])) Loading @@ -363,7 +363,7 @@ class Ui(QtWidgets.QMainWindow): c += 1 if self.has_groups: if (not showAllSavedData) and (int(row['group']) not in self.groups): if (not showAllSavedData) and (row['group'] not in self.groups): self.fileList.hideRow(i) # Order by RA coordinate: Loading Loading @@ -399,11 +399,11 @@ class Ui(QtWidgets.QMainWindow): # Identify row by filename (better than index) # item_index = self.df['filename'] == fn if self.has_groups: grp = int(self.fileList.item(index, 0).text()) gal = int(self.fileList.item(index, 1).text()) grp = self.fileList.item(index, 0).text() gal = self.fileList.item(index, 1).text() item_index = self.df.index[(self.df['group']==grp) & (self.df['galaxy']==gal)] else: gal = int(self.fileList.item(index, 0).text()) gal = self.fileList.item(index, 0).text() item_index = self.df.index[self.df['galaxy']==gal] self.df.loc[item_index, 'processed'] = True Loading Loading @@ -456,11 +456,11 @@ class Ui(QtWidgets.QMainWindow): index = self.fileList.selectionModel().selectedRows()[0].row() try: if self.has_groups: grp = int(self.fileList.item(index, 0).text()) gal = int(self.fileList.item(index, 1).text()) grp = self.fileList.item(index, 0).text() gal = self.fileList.item(index, 1).text() item_index = (self.df['group']==grp) & (self.df['galaxy']==gal) else: gal = int(self.fileList.item(index, 0).text()) gal = self.fileList.item(index, 0).text() item_index = self.df['galaxy']==gal Loading Loading @@ -565,8 +565,8 @@ class Ui(QtWidgets.QMainWindow): if not self.has_groups: return for i in range(self.fileList.rowCount()): row = self.fileList.item(i, 0).text() if (not showAllSavedData) and (int(row) not in self.groups): group = self.fileList.item(i, 0).text() if (not showAllSavedData) and (group not in self.groups): self.fileList.hideRow(i) else: self.fileList.showRow(i) Loading src/utils.py +23 −20 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ def getOptions(version): help="""Galaxy database file in *.csv format. Minimum required columns: ['galaxy', 'filename' or 'fits' ]. Recomended columns: ['group', 'galaxy', 'ra', 'dec', 'filename' or 'fits']""") parser.add_argument('group', metavar='GROUP', type=int, nargs='*', parser.add_argument('group', metavar='GROUP', nargs='*', help="Group number. Selects images with name format: img_<group>_*.png\n") args = parser.parse_args() Loading Loading @@ -81,7 +81,7 @@ def getFiles(): for group in inputGroups: if group in availableGroups: selectedFiles = pd_concat(selectedFiles, groups[groups.group == group]) selectedGroups.append(int(group)) selectedGroups.append(group) else: print(f'WARNING:\tGroup {group} not available.') else: Loading Loading @@ -128,8 +128,8 @@ def readInputFile(fname:str) -> pd.DataFrame: print(f"INFO:\tReading from '{fname}' file... ", end='', flush=True) df = pd.read_csv(fname, converters={ 'group': int, 'galaxy': int, 'group': str, 'galaxy': str, 'ra': float, 'dec': float, } Loading Loading @@ -250,8 +250,8 @@ def expand_df(selectedFiles): if Path(args.savefile).is_file(): importData = pd.read_csv(args.savefile, converters={ 'group': int, 'galaxy': int, 'group': str, 'galaxy': str, } ) Loading @@ -260,9 +260,9 @@ def expand_df(selectedFiles): checkColumnsMismatch(importData.columns.values) importData['processed'] = True if 'filename' in importData.columns: if 'filename' in groups.columns: importData['fullpath'] = '' if 'ra' in importData.columns and 'dec' in importData.columns: if 'ra' in groups.columns and 'dec' in groups.columns: importData['ra'] = 0 importData['dec'] = 0 Loading Loading @@ -307,14 +307,21 @@ def expand_df(selectedFiles): def newEntry(row:pd.Series) -> dict: entry = {'galaxy': row.galaxy} entry = {} if 'group' in row: entry.update({'group': row.group}) if 'galaxy' in row: entry.update({'galaxy': row.galaxy}) if 'filename' in row: file = Path(args.path) / Path(row['filename']) entry.update({'filename': file.name}) # default value if 'group' in row: entry.update({'group': row.group}) if 'fits' in row: entry.update({'fits': row.fits}) entry.update({'fits_coords': []}) # ID needed? to separate widget groups? for i, rbgCol in enumerate(getRadioButtonGroups()): Loading @@ -326,10 +333,6 @@ def newEntry(row:pd.Series) -> dict: for i, tbCol in enumerate(getTextBoxes()): entry.update({tbCol: ''}) if 'fits' in row: entry.update({'fits': row.fits}) entry.update({'fits_coords': []}) entry.update({'processed': False}) if 'filename' in row: Loading Loading
src/gui.py +11 −11 Original line number Diff line number Diff line Loading @@ -338,11 +338,11 @@ class Ui(QtWidgets.QMainWindow): c = 0 # Place group data in integer format: if self.has_groups: self.fileList.setItem(i, c, self.create_table_item(int(row['group']))) self.fileList.setItem(i, c, self.create_table_item(row['group'])) c += 1 # Place galaxy data in integer format: self.fileList.setItem(i, c, self.create_table_item(int(row['galaxy']))) self.fileList.setItem(i, c, self.create_table_item(row['galaxy'])) c += 1 # Set Icon in the row: self.fileList.setCellWidget(i, c, self.getIconCell(row['processed'])) Loading @@ -363,7 +363,7 @@ class Ui(QtWidgets.QMainWindow): c += 1 if self.has_groups: if (not showAllSavedData) and (int(row['group']) not in self.groups): if (not showAllSavedData) and (row['group'] not in self.groups): self.fileList.hideRow(i) # Order by RA coordinate: Loading Loading @@ -399,11 +399,11 @@ class Ui(QtWidgets.QMainWindow): # Identify row by filename (better than index) # item_index = self.df['filename'] == fn if self.has_groups: grp = int(self.fileList.item(index, 0).text()) gal = int(self.fileList.item(index, 1).text()) grp = self.fileList.item(index, 0).text() gal = self.fileList.item(index, 1).text() item_index = self.df.index[(self.df['group']==grp) & (self.df['galaxy']==gal)] else: gal = int(self.fileList.item(index, 0).text()) gal = self.fileList.item(index, 0).text() item_index = self.df.index[self.df['galaxy']==gal] self.df.loc[item_index, 'processed'] = True Loading Loading @@ -456,11 +456,11 @@ class Ui(QtWidgets.QMainWindow): index = self.fileList.selectionModel().selectedRows()[0].row() try: if self.has_groups: grp = int(self.fileList.item(index, 0).text()) gal = int(self.fileList.item(index, 1).text()) grp = self.fileList.item(index, 0).text() gal = self.fileList.item(index, 1).text() item_index = (self.df['group']==grp) & (self.df['galaxy']==gal) else: gal = int(self.fileList.item(index, 0).text()) gal = self.fileList.item(index, 0).text() item_index = self.df['galaxy']==gal Loading Loading @@ -565,8 +565,8 @@ class Ui(QtWidgets.QMainWindow): if not self.has_groups: return for i in range(self.fileList.rowCount()): row = self.fileList.item(i, 0).text() if (not showAllSavedData) and (int(row) not in self.groups): group = self.fileList.item(i, 0).text() if (not showAllSavedData) and (group not in self.groups): self.fileList.hideRow(i) else: self.fileList.showRow(i) Loading
src/utils.py +23 −20 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ def getOptions(version): help="""Galaxy database file in *.csv format. Minimum required columns: ['galaxy', 'filename' or 'fits' ]. Recomended columns: ['group', 'galaxy', 'ra', 'dec', 'filename' or 'fits']""") parser.add_argument('group', metavar='GROUP', type=int, nargs='*', parser.add_argument('group', metavar='GROUP', nargs='*', help="Group number. Selects images with name format: img_<group>_*.png\n") args = parser.parse_args() Loading Loading @@ -81,7 +81,7 @@ def getFiles(): for group in inputGroups: if group in availableGroups: selectedFiles = pd_concat(selectedFiles, groups[groups.group == group]) selectedGroups.append(int(group)) selectedGroups.append(group) else: print(f'WARNING:\tGroup {group} not available.') else: Loading Loading @@ -128,8 +128,8 @@ def readInputFile(fname:str) -> pd.DataFrame: print(f"INFO:\tReading from '{fname}' file... ", end='', flush=True) df = pd.read_csv(fname, converters={ 'group': int, 'galaxy': int, 'group': str, 'galaxy': str, 'ra': float, 'dec': float, } Loading Loading @@ -250,8 +250,8 @@ def expand_df(selectedFiles): if Path(args.savefile).is_file(): importData = pd.read_csv(args.savefile, converters={ 'group': int, 'galaxy': int, 'group': str, 'galaxy': str, } ) Loading @@ -260,9 +260,9 @@ def expand_df(selectedFiles): checkColumnsMismatch(importData.columns.values) importData['processed'] = True if 'filename' in importData.columns: if 'filename' in groups.columns: importData['fullpath'] = '' if 'ra' in importData.columns and 'dec' in importData.columns: if 'ra' in groups.columns and 'dec' in groups.columns: importData['ra'] = 0 importData['dec'] = 0 Loading Loading @@ -307,14 +307,21 @@ def expand_df(selectedFiles): def newEntry(row:pd.Series) -> dict: entry = {'galaxy': row.galaxy} entry = {} if 'group' in row: entry.update({'group': row.group}) if 'galaxy' in row: entry.update({'galaxy': row.galaxy}) if 'filename' in row: file = Path(args.path) / Path(row['filename']) entry.update({'filename': file.name}) # default value if 'group' in row: entry.update({'group': row.group}) if 'fits' in row: entry.update({'fits': row.fits}) entry.update({'fits_coords': []}) # ID needed? to separate widget groups? for i, rbgCol in enumerate(getRadioButtonGroups()): Loading @@ -326,10 +333,6 @@ def newEntry(row:pd.Series) -> dict: for i, tbCol in enumerate(getTextBoxes()): entry.update({tbCol: ''}) if 'fits' in row: entry.update({'fits': row.fits}) entry.update({'fits_coords': []}) entry.update({'processed': False}) if 'filename' in row: Loading