Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/targetdb/cli/cli_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
check_duplicates(
indir=directory,
outdir=output_dir,
file_format=file_format,
file_format=file_format.value,
skip_save_merged=skip_save_merged,
additional_columns=additional_columns,
check_columns=check_columns,
Expand Down Expand Up @@ -306,7 +306,7 @@
input_catalog_id,
input_catalog_name,
rename_cols=rename_cols,
file_format=file_format,
file_format=file_format.value,
)


Expand Down Expand Up @@ -353,7 +353,7 @@

draw_diagram(
config,
generator=generator,
generator=generator.value,
output_dir=output_dir,
title=title,
sc_info_level=sc_info_level,
Expand Down Expand Up @@ -417,7 +417,7 @@
typer.Option(
"--flux-type", help="Flux type for the flux standard star catalog."
),
] = "total",
] = FluxType.total,

Check warning

Code scanning / Pylint (reported by Codacy)

No space allowed around keyword argument assignment Warning

No space allowed around keyword argument assignment
upload_id: Annotated[
str,
typer.Option(
Expand Down Expand Up @@ -449,14 +449,14 @@

add_database_rows(
input_file=input_file,
table=table,
table=table.value,
commit=commit,
fetch=fetch,
verbose=verbose,
config=config,
df=df,
from_uploader=from_uploader,
flux_type=flux_type,
flux_type=flux_type.value,
proposal_id=proposal_id,
upload_id=upload_id,
insert=True,
Expand Down Expand Up @@ -663,7 +663,7 @@
typer.Option(
"--flux-type", help="Flux type for the flux standard star catalog."
),
] = "total",
] = FluxType.total,

Check warning

Code scanning / Pylint (reported by Codacy)

No space allowed around keyword argument assignment Warning

No space allowed around keyword argument assignment
commit: Annotated[
bool,
typer.Option("--commit", help="Commit changes to the database."),
Expand All @@ -685,7 +685,7 @@
df_input_catalogs,
config,
data_dir=data_dir,
flux_type=flux_type,
flux_type=flux_type.value,
commit=commit,
fetch=fetch,
verbose=verbose,
Expand Down
6 changes: 6 additions & 0 deletions src/targetdb/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,12 @@ def make_target_df_from_uploader(
except AttributeError:
pass
if f"flux_{band}" in df.columns:
logger.info(f"flux_{band} is renamed to {flux_type}_flux_{band}")
df.rename(
columns={f"flux_{band}": f"{flux_type}_flux_{band}"}, inplace=True
)
if f"flux_error_{band}" in df.columns:
logger.info("flux_error_{band} is renamed to {flux_type}_flux_error_{band}")
df.rename(
columns={f"flux_error_{band}": f"{flux_type}_flux_error_{band}"},
inplace=True,
Expand Down Expand Up @@ -875,6 +877,10 @@ def add_database_rows(
dry_run = True
logger.info("No changes will be committed to targetDB (i.e., dry run)")

# logger.info(f"{df['total_flux_r'][:100]}")
# db.close()
# exit()

if insert:
db.insert(table, df, dry_run=dry_run)
elif update:
Expand Down