Skip to content

Commit

Permalink
ruff unsafe on cmfgen2tardis
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-2001 committed Oct 16, 2024
1 parent ce1ca17 commit 9a3c268
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tardis/scripts/cmfgen2tardis.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import sys
import argparse
import os

Check warning on line 2 in tardis/scripts/cmfgen2tardis.py

View check run for this annotation

Codecov / codecov/patch

tardis/scripts/cmfgen2tardis.py#L2

Added line #L2 was not covered by tests

import numpy as np
import pandas as pd

from tardis.io.atom_data import AtomData

# The from_hdf() method requires an argument, so the line below doesn't work
# atomic_dataset = AtomData.from_hdf()

Expand Down Expand Up @@ -40,7 +38,7 @@ def extract_file_block(f):
def convert_format(file_path):
quantities_row = []
prop_list = ["Velocity", "Density", "Electron density", "Temperature"]
with open(file_path, "r") as f:
with open(file_path) as f:

Check warning on line 41 in tardis/scripts/cmfgen2tardis.py

View check run for this annotation

Codecov / codecov/patch

tardis/scripts/cmfgen2tardis.py#L41

Added line #L41 was not covered by tests
for line in f:
items = line.replace("(", "").replace(")", "").split()
n = len(items)
Expand Down Expand Up @@ -102,7 +100,7 @@ def parse_file(args):
)

filename = os.path.splitext(os.path.basename(args.input_path))[0]
save_fname = ".".join((filename, "csv"))
save_fname = f"{filename}.csv"

Check warning on line 103 in tardis/scripts/cmfgen2tardis.py

View check run for this annotation

Codecov / codecov/patch

tardis/scripts/cmfgen2tardis.py#L103

Added line #L103 was not covered by tests
resultant_df = pd.concat([density_df, abundances_df], axis=1)
resultant_df.columns = pd.MultiIndex.from_tuples(
zip(resultant_df.columns, quantities_row)
Expand Down

0 comments on commit 9a3c268

Please sign in to comment.