Skip to content

Commit

Permalink
Explicitly assign local field in AmBe/YBe generator
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq authored Aug 20, 2024
1 parent ec31614 commit f6d12e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions saltax/instructions/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def generator_ambe(
rate=1e9 / SALT_TIME_INTERVAL,
time_mode="uniform",
ambe_instructions_file=AMBE_INSTRUCTIONS_FILE,
fmap=FIELD_MAP,
**kwargs
):
"""Generate instructions for a run with AmBe source.
Expand All @@ -340,6 +341,7 @@ def generator_ambe(
:param time_mode: 'uniform' or 'realistic', default: 'uniform'
:param ambe_instructions_file: file containing ambe instructions,
default: AMBE_INSTRUCTIONS_FILE
:param fmap: field map, default: FIELD_MAP, defined above
:return: instructions in numpy array
"""
# determine time offsets to shift ambe instructions
Expand Down Expand Up @@ -372,6 +374,8 @@ def generator_ambe(
instr_i["e_dep"] = selected_ambe["e_dep"]
instr_i["amp"] = selected_ambe["amp"]
instr_i["n_excitons"] = selected_ambe["n_excitons"]
instr_i["local_field"] = fmap(np.array([np.sqrt(selected_ambe["x"]**2 + selected_ambe["y"]**2),
selected_ambe["z"]]).T).repeat(2)

# concatenate instr
instr = np.concatenate((instr, instr_i))
Expand All @@ -388,6 +392,7 @@ def generator_ybe(
rate=1e9 / SALT_TIME_INTERVAL,
time_mode="uniform",
ybe_instructions_file=YBE_INSTRUCTIONS_FILE,
fmap=FIELD_MAP,
**kwargs
):
"""Generate instructions for a run with YBe source.
Expand All @@ -403,6 +408,7 @@ def generator_ybe(
:param time_mode: 'uniform' or 'realistic', default: 'uniform'
:param ybe_instructions_file: file containing ybe instructions,
default: YBE_INSTRUCTIONS_FILE
:param fmap: field map, default: FIELD_MAP, defined above
:return: instructions in numpy array
"""
# determine time offsets to shift ybe instructions
Expand Down Expand Up @@ -433,6 +439,8 @@ def generator_ybe(
instr_i["e_dep"] = selected_ybe["e_dep"]
instr_i["amp"] = selected_ybe["amp"]
instr_i["n_excitons"] = selected_ybe["n_excitons"]
instr_i["local_field"] = fmap(np.array([np.sqrt(selected_ybe["x"]**2 + selected_ybe["y"]**2),
selected_ybe["z"]]).T).repeat(2)

# concatenate instr
instr = np.concatenate((instr, instr_i))
Expand Down

0 comments on commit f6d12e4

Please sign in to comment.