|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | EngineMetadata |
Functions | |
| Tuple[int, int, Dict[str, int]] | _detect_column_indices (List[str] headers) |
| Tuple[Optional[str], Optional[str]] | _detect_units_from_header (str header) |
| bool | _is_comment_line (str line) |
| Optional[float] | _parse_numeric (str value) |
| Tuple[EngineMetadata, CurvePoints] | read_csv_curve (Union[str, Path] path, Optional[str] time_units=None, Optional[str] thrust_units=None) |
| CurvePoints | normalize_curve (CurvePoints points, int time_decimals=3, int thrust_decimals=1) |
| None | write_eng (Union[str, Path] path, EngineMetadata metadata, CurvePoints points, int time_decimals=3, int thrust_decimals=1, bool include_comment=True) |
| None | convert (Union[str, Path] csv_path, Union[str, Path] eng_path, Optional[str] name=None, Optional[float] diameter_mm=None, Optional[float] length_mm=None, Optional[str] delays=None, Optional[float] prop_mass_kg=None, Optional[float] total_mass_kg=None, Optional[str] manufacturer=None, Optional[str] time_units=None, Optional[str] thrust_units=None, int time_decimals=3, int thrust_decimals=1) |
Variables | |
| float | LBF_TO_N = 4.4482216152605 |
| float | MS_TO_S = 0.001 |
| dict | TIME_COLUMNS = {"time", "t", "seconds", "time_s", "time_ms"} |
| dict | THRUST_COLUMNS = {"thrust", "f", "force", "thrust_n", "thrust_lbf"} |
| dict | METADATA_COLUMNS |
| CurvePoints = List[Tuple[float, float]] | |
Core functionality for CSV to .eng conversion.
|
protected |
Detect time and thrust column indices from headers.
Returns:
(time_idx, thrust_idx, metadata_col_indices)
Raises:
ValueError: If time or thrust columns cannot be identified.
Definition at line 77 of file core.py.
Referenced by read_csv_curve().
|
protected |
Detect units from column header suffix.
Returns:
(time_unit, thrust_unit) - None if not detected
Definition at line 135 of file core.py.
Referenced by read_csv_curve().
|
protected |
Check if a line is a comment.
Definition at line 159 of file core.py.
Referenced by read_csv_curve().
|
protected |
Parse a string to float, returning None on failure.
Definition at line 165 of file core.py.
Referenced by read_csv_curve().
| None csv_to_eng.core.convert | ( | Union[str, Path] | csv_path, |
| Union[str, Path] | eng_path, | ||
| Optional[str] | name = None, | ||
| Optional[float] | diameter_mm = None, | ||
| Optional[float] | length_mm = None, | ||
| Optional[str] | delays = None, | ||
| Optional[float] | prop_mass_kg = None, | ||
| Optional[float] | total_mass_kg = None, | ||
| Optional[str] | manufacturer = None, | ||
| Optional[str] | time_units = None, | ||
| Optional[str] | thrust_units = None, | ||
| int | time_decimals = 3, | ||
| int | thrust_decimals = 1 ) |
Convert a CSV thrust curve file to RASP .eng format.
This is the high-level convenience function that combines read, normalize,
and write operations.
Args:
csv_path: Input CSV file path.
eng_path: Output .eng file path.
name: Engine name override.
diameter_mm: Engine diameter in mm override.
length_mm: Engine length in mm override.
delays: Delay charges string override.
prop_mass_kg: Propellant mass in kg override.
total_mass_kg: Total loaded mass in kg override.
manufacturer: Manufacturer name override.
time_units: Force time units ("s" or "ms").
thrust_units: Force thrust units ("N" or "lbf").
time_decimals: Decimal places for time (default 3).
thrust_decimals: Decimal places for thrust (default 1).
Definition at line 389 of file core.py.
References normalize_curve(), read_csv_curve(), and write_eng().
| CurvePoints csv_to_eng.core.normalize_curve | ( | CurvePoints | points, |
| int | time_decimals = 3, | ||
| int | thrust_decimals = 1 ) |
Normalize thrust curve data.
Operations:
1. Sort by time (ascending)
2. Remove duplicate time entries (keep last value for each time)
3. Ensure curve starts at t=0 (insert if missing)
4. Ensure curve ends with thrust=0 at burnout (append if needed)
5. Round values to specified decimal places
Args:
points: List of (time_s, thrust_N) tuples.
time_decimals: Decimal places for time (default 3).
thrust_decimals: Decimal places for thrust (default 1).
Returns:
Normalized list of (time_s, thrust_N) tuples.
Definition at line 295 of file core.py.
Referenced by convert().
| Tuple[EngineMetadata, CurvePoints] csv_to_eng.core.read_csv_curve | ( | Union[str, Path] | path, |
| Optional[str] | time_units = None, | ||
| Optional[str] | thrust_units = None ) |
Read a CSV file containing thrust curve data.
Args:
path: Path to the CSV file.
time_units: Force time units ("s" or "ms"). Auto-detected if None.
thrust_units: Force thrust units ("N" or "lbf"). Auto-detected if None.
Returns:
Tuple of (EngineMetadata, list of (time_s, thrust_N) tuples)
Raises:
FileNotFoundError: If file doesn't exist.
ValueError: If CSV format is invalid.
Definition at line 173 of file core.py.
References _detect_column_indices(), _detect_units_from_header(), _is_comment_line(), _parse_numeric(), and max.
Referenced by convert().
| None csv_to_eng.core.write_eng | ( | Union[str, Path] | path, |
| EngineMetadata | metadata, | ||
| CurvePoints | points, | ||
| int | time_decimals = 3, | ||
| int | thrust_decimals = 1, | ||
| bool | include_comment = True ) |
Write thrust curve data to a RASP .eng file.
Args:
path: Output file path.
metadata: Engine metadata for header line.
points: List of (time_s, thrust_N) tuples.
time_decimals: Decimal places for time output (default 3).
thrust_decimals: Decimal places for thrust output (default 1).
include_comment: Include generator comment at top (default True).
Definition at line 349 of file core.py.
Referenced by convert().
| dict csv_to_eng.core.METADATA_COLUMNS |
| dict csv_to_eng.core.THRUST_COLUMNS = {"thrust", "f", "force", "thrust_n", "thrust_lbf"} |