Skip to content

Commit

Permalink
remove leading zeros for some columns for the latex table
Browse files Browse the repository at this point in the history
  • Loading branch information
myla committed Oct 17, 2024
1 parent d4939c5 commit a61c7a6
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions data_extraction/build_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,32 @@
multi_col_df_compaction = table_df_dict["densification"]
# print(table_df_dict["compression"])

# remove leading zero in SSIM and LPIPS rows
# print(multi_col_df_compression.keys())
for i in ["Tanks and Temples", "Mip-NeRF 360", "Deep Blending", "Synthetic NeRF"]:
for j in ["SSIM", "LPIPS"]:
multi_col_df_compression[(i, j)] = (
multi_col_df_compression[(i, j)]
.astype(str)
.replace(
r"(<td[^>]*>)0\.(\d+)", r"\1.\2", regex=True
) # Removes leading zero in cells with HTML tags
.replace(
r"^0\.(\d+)", r".\1", regex=True
) # Removes leading zero in cells without HTML tags
)
if i != "Synthetic NeRF":
multi_col_df_compaction[(i, j)] = (
multi_col_df_compaction[(i, j)]
.astype(str)
.replace(
r"(<td[^>]*>)0\.(\d+)", r"\1.\2", regex=True
) # Removes leading zero in cells with HTML tags
.replace(
r"^0\.(\d+)", r".\1", regex=True
) # Removes leading zero in cells without HTML tags
)


def extract_title_and_text(markdown: str):
markdown = markdown.strip()
Expand Down Expand Up @@ -372,9 +398,9 @@ def cp_images(src_folder, dst_folder):

lines = buffer.getvalue().strip().split("\n")
if method_i == "compression":
lines[0] = "\\begin{tabular}{ll|llll|llll|llll|llll}"
lines[0] = "\\begin{tabular}{ll|lllr|lllr|lllr|lllr}"
else:
lines[0] = "\\begin{tabular}{ll|lllr|lllr|lllr}"
lines[0] = "\\begin{tabular}{ll|lrrr|lrrr|lrrr}"
lines[2] = (
lines[2]
.replace("{r}", "{c|}")
Expand Down

0 comments on commit a61c7a6

Please sign in to comment.