Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Calculation Function of Ground Image Position in Telescope #641

Open
wants to merge 42 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d13bbf2
modify func
Hiro-0110 Apr 23, 2024
e2bf445
Merge branch 'develop' of github.com:ut-issl/s2e-core into feature/mo…
Hiro-0110 May 7, 2024
d306921
modify telescope
Hiro-0110 May 7, 2024
062b940
modify ini file
Hiro-0110 May 7, 2024
58f3e76
minor change
Hiro-0110 May 7, 2024
1dc0e5e
modify telescope func
Hiro-0110 May 14, 2024
8273601
Merge branch 'develop' of github.com:ut-issl/s2e-core into feature/mo…
Hiro-0110 May 14, 2024
ff3fb4b
monor change
Hiro-0110 May 15, 2024
608e8ee
minor change
Hiro-0110 May 15, 2024
86d9faa
chnange ini
Hiro-0110 May 15, 2024
82b320e
fix format error
Hiro-0110 May 15, 2024
37abecb
fix format error
Hiro-0110 May 15, 2024
df94c79
fix format error
Hiro-0110 May 15, 2024
21cdbdc
change order
Hiro-0110 May 15, 2024
0ed8a64
change day to sec
Hiro-0110 May 15, 2024
dc32eb1
fix format error
Hiro-0110 May 17, 2024
f5fb983
change orbit calc
Hiro-0110 May 24, 2024
33cd39b
fix orbit calc error
Hiro-0110 May 24, 2024
cfe3a70
fix rror
Hiro-0110 May 24, 2024
015451e
minor change in ini file
Hiro-0110 May 24, 2024
d8faf07
fix format error
Hiro-0110 May 24, 2024
a5dbccd
minor change
Hiro-0110 May 24, 2024
5217ce0
fix format error
Hiro-0110 May 24, 2024
ff564bb
minor change
Hiro-0110 May 31, 2024
0184579
revert orbit propagation
Hiro-0110 Jun 4, 2024
4ce1d7c
minor update
Hiro-0110 Jun 4, 2024
6cdd713
minor change
Hiro-0110 Jun 4, 2024
85ae71b
minor change
Hiro-0110 Jun 4, 2024
cb65c6c
fix flag
Hiro-0110 Jun 4, 2024
fdf990d
minor change
Hiro-0110 Jun 4, 2024
1ba8153
minor update
Hiro-0110 Jun 4, 2024
67e0a11
update plot
Hiro-0110 Jun 4, 2024
cca9d61
update plot
Hiro-0110 Jun 4, 2024
26459f5
minor change
Hiro-0110 Jun 4, 2024
f08bcb4
minor change
Hiro-0110 Jun 4, 2024
f90296d
Merge branch 'develop' of github.com:ut-issl/s2e-core into feature/mo…
Hiro-0110 Jun 10, 2024
f56fe03
partial change
Hiro-0110 Jun 10, 2024
ba14b9c
partial change
Hiro-0110 Jun 10, 2024
c2e4b95
change after review
Hiro-0110 Jun 10, 2024
231580f
solve format error
Hiro-0110 Jun 10, 2024
a63af2b
solve format error
Hiro-0110 Jun 10, 2024
bd1bd14
fix error
Hiro-0110 Jun 10, 2024
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
24 changes: 23 additions & 1 deletion data/sample/initialize_files/components/telescope.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ moon_exclusion_angle_deg = 60
x_number_of_pixel = 2048

// Number of pixel in the Y direction of image sensor
y_number_of_pixel = 2048
y_number_of_pixel = 4000

// pixel size p
pixel_size_m = 0.02

// Focal length f
focal_length_m = 1.0

// Field of View(FoV) angle per pixel in the X direction of image sensor
// x_number_of_pixel * x_fov_deg_per_pixel should be smallser than 90 deg.
Expand All @@ -31,5 +37,21 @@ x_fov_deg_per_pixel = 0.02
// y_number_of_pixel * y_fov_deg_per_pixel should be smallser than 90 deg.
y_fov_deg_per_pixel = 0.02

// Start Imaging time [UTC]
// The time when the imaging starts and must be after the simulation start time
start_imaging_time_utc = 2020/04/01 12:00:10.0

// Line Rate [sec]
line_rate_sec = 1.0

// Stage mode
stage_mode = 10

// Number of lines per frame
number_of_lines_per_frame = 10

// Number of frame per mission
number_of_frames_per_mission = 1

// Number of stars to show log output
number_of_stars_for_log = 3
105 changes: 82 additions & 23 deletions scripts/Plot/plot_ground_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
# Import
#
# plots
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import argparse
# local function
from common import find_latest_log_tag
from common import add_log_file_arguments
from common import read_scalar_from_csv
# arguments
import argparse

# Arguments
aparser = argparse.ArgumentParser()
aparser = add_log_file_arguments(aparser)
aparser.add_argument('--no-gui', action='store_true')
args = aparser.parse_args()


#
# Read Arguments
#
# log file path
path_to_logs = args.logs_dir

read_file_tag = args.file_tag
if read_file_tag == None:
if read_file_tag is None:
print("file tag does not found. use latest.")
read_file_tag = find_latest_log_tag(path_to_logs)

Expand All @@ -46,23 +46,82 @@
# Data read and edit
#
# Read S2E CSV
x_data = read_scalar_from_csv(
read_file_name, 'telescope_ground_position_x[pix]')
y_data = read_scalar_from_csv(
read_file_name, 'telescope_ground_position_y[pix]')
#
# Plot
#
plt.figure(figsize=(10, 7))
plt.scatter(x_data, y_data, s=2, alpha=1.0)
plt.title("Scatter plot of ground position in the image sensor")
plt.xlabel("X [pix]")
plt.ylabel("Y [pix]")
plt.grid(True)
x_center_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_center_x[pix]'))
y_center_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_center_y[pix]'))
x_ymax_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_y_max_x[pix]'))
y_ymax_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_y_max_y[pix]'))
x_ymin_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_y_min_x[pix]'))
y_ymin_data = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_ground_position_y_min_y[pix]'))
telescope_flag = np.ravel(read_scalar_from_csv(
read_file_name, 'telescope_flag'))

# Combine data into a DataFrame
data = pd.DataFrame({
'x_center': x_center_data,
'y_center': y_center_data,
'x_ymax': x_ymax_data,
'y_ymax': y_ymax_data,
'x_ymin': x_ymin_data,
'y_ymin': y_ymin_data,
'telescope_flag': telescope_flag
})

# Define a function to plot data for a specific flag


def plot_for_flag(flag, data, no_gui):
if flag == 1:
number = "1st"
elif flag == 2:
number = "2nd"
elif flag == 3:
number = "3rd"
filtered_data = data[data['telescope_flag'] == flag]
fig, axs = plt.subplots(3, 1, figsize=(10, 15))

axs[0].scatter(filtered_data['x_center'],
filtered_data['y_center'], s=5, alpha=1.0, label='Center')
axs[1].scatter(filtered_data['x_ymax'],
filtered_data['y_ymax'], s=5, alpha=1.0, label='Y Max')
axs[2].scatter(filtered_data['x_ymin'],
filtered_data['y_ymin'], s=5, alpha=1.0, label='Y Min')
fig.suptitle(
f"Scatter plot of ground position in the image sensor ({number})")
axs[0].set_xlabel("X [pix]")
axs[0].set_ylabel("Y [pix]")
axs[1].set_xlabel("X [pix]")
axs[1].set_ylabel("Y [pix]")
axs[2].set_xlabel("X [pix]")
axs[2].set_ylabel("Y [pix]")
axs[0].legend()
axs[1].legend()
axs[2].legend()
axs[0].set_xticks(np.arange(int(min(filtered_data['x_center']))-1, 1, 1))
axs[1].set_xticks(np.arange(int(min(filtered_data['x_ymax']))-1, 1, 1))
axs[2].set_xticks(np.arange(int(min(filtered_data['x_ymin']))-1, 1, 1))
axs[0].set_ylim(int(min(filtered_data['y_center']))-0.01,
int(max(filtered_data['y_center']))+0.01)
axs[1].set_ylim(int(min(filtered_data['y_ymax']))-0.01,
int(max(filtered_data['y_ymax']))+0.01)
axs[2].set_ylim(int(min(filtered_data['y_ymin']))-0.01,
int(max(filtered_data['y_ymin']))+0.01)
axs[0].grid(True)
axs[1].grid(True)
axs[2].grid(True)

# Data save
if no_gui:
plt.savefig(f"{read_file_tag}_ground_position_{number}.png")
else:
plt.show()


# Data save
if args.no_gui:
# save last figure only
plt.savefig(read_file_tag + "_ground_position.png")
else:
plt.show()
# Plot for each flag
for flag in [1, 2, 3]:
plot_for_flag(flag, data, args.no_gui)
Loading
Loading