-
Notifications
You must be signed in to change notification settings - Fork 2
(draft) Accelerator master frequency #86
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
Draft
VitorSouzaLNLS
wants to merge
8
commits into
master
Choose a base branch
from
accelerator-master-frequency
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0667748
ADD: add accelerator frequency property
VitorSouzaLNLS c2d47af
MNT: swap element's frequency -> harmonic
VitorSouzaLNLS 48f5bb1
MNT: match Accelerator and Element properties in cavity pass method
VitorSouzaLNLS 0beb762
MNT: swap frequency -> harmonic in RF Cavity Element constructors
VitorSouzaLNLS aa19a71
MNT: update lattice utils
VitorSouzaLNLS 4a5af40
MNT: match accelerator's frequency property in track_findorbit6
VitorSouzaLNLS 988dce9
MNT: update sirius_v500 creation and usage
VitorSouzaLNLS eb0c52e
MNT: update flat_file read/write with Accelerator's frequency and Ele…
VitorSouzaLNLS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,7 @@ void write_flat_file_trackcpp(std::ostream& fp, const Accelerator& accelerator) | |
|
|
||
| fp << std::setw(hw) << "% energy" << accelerator.energy << " eV\n"; | ||
| fp << std::setw(hw) << "% harmonic_number" << accelerator.harmonic_number << "\n"; | ||
| fp << std::setw(hw) << "% frequency" << accelerator.frequency << "\n"; | ||
| fp << std::setw(hw) << "% cavity_on" << get_boolean_string(accelerator.cavity_on) << "\n"; | ||
| fp << std::setw(hw) << "% radiation_on" << accelerator.radiation_on << "\n"; | ||
| fp << std::setw(hw) << "% vchamber_on" << get_boolean_string(accelerator.vchamber_on) << "\n"; | ||
|
|
@@ -122,7 +123,7 @@ void write_flat_file_trackcpp(std::ostream& fp, const Accelerator& accelerator) | |
| if (e.fint_in != 0) { fp << std::setw(pw) << "fint_in" << e.fint_in << '\n'; } | ||
| if (e.fint_out != 0) { fp << std::setw(pw) << "fint_out" << e.fint_out << '\n'; } | ||
| if (e.voltage != 0) { fp << std::setw(pw) << "voltage" << e.voltage << '\n'; } | ||
| if (e.frequency != 0) { fp << std::setw(pw) << "frequency" << e.frequency << '\n'; } | ||
| if (e.harmonic != 0) { fp << std::setw(pw) << "harmonic" << e.harmonic << '\n'; } | ||
| if (e.phase_lag != 0) { fp << std::setw(pw) << "phase_lag" << e.phase_lag << '\n'; } | ||
| if (e.angle_in != 0) { fp << std::setw(pw) << "angle_in" << e.angle_in << '\n'; } | ||
| if (e.angle_out != 0) { fp << std::setw(pw) << "angle_out" << e.angle_out << '\n'; } | ||
|
|
@@ -170,6 +171,7 @@ Status::type read_flat_file_trackcpp(std::istream& fp, Accelerator& accelerator) | |
| bool found_hmin = false; | ||
| bool found_vmin = false; | ||
| unsigned int line_count = 0; | ||
| std::vector<double> frequencies = {}; | ||
| while (std::getline(fp, line)) { | ||
| //std::cout << line << std::endl; | ||
| line_count++; | ||
|
|
@@ -182,6 +184,7 @@ Status::type read_flat_file_trackcpp(std::istream& fp, Accelerator& accelerator) | |
| ss >> cmd; | ||
| if (cmd.compare("energy") == 0) { ss >> accelerator.energy; continue; } | ||
| if (cmd.compare("harmonic_number") == 0) { ss >> accelerator.harmonic_number; continue; } | ||
| if (cmd.compare("frequency") == 0) { ss >> accelerator.frequency; continue; } | ||
| if (cmd.compare("cavity_on") == 0) { accelerator.cavity_on = read_boolean_string(ss); continue; } | ||
| // radiation_on needs its own processing function due backward compatibility | ||
| if (cmd.compare("radiation_on") == 0){ accelerator.radiation_on = process_rad_property(ss); continue; } | ||
|
|
@@ -221,7 +224,13 @@ Status::type read_flat_file_trackcpp(std::istream& fp, Accelerator& accelerator) | |
| if (cmd.compare("fint_in") == 0) { ss >> e.fint_in; continue; } | ||
| if (cmd.compare("fint_out") == 0) { ss >> e.fint_out; continue; } | ||
| if (cmd.compare("voltage") == 0) { ss >> e.voltage; continue; } | ||
| if (cmd.compare("frequency") == 0) { ss >> e.frequency; continue; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about reading old lattice flatten files ? |
||
| if (cmd.compare("harmonic") == 0) { ss >> e.harmonic; continue; } | ||
| if (cmd.compare("frequency") == 0) { | ||
| double freq; | ||
| ss >> freq; | ||
| frequencies.push_back(freq); | ||
| continue; | ||
| } | ||
| if (cmd.compare("phase_lag") == 0) { ss >> e.phase_lag; continue; } | ||
| if (cmd.compare("angle_in") == 0) { ss >> e.angle_in; continue; } | ||
| if (cmd.compare("angle_out") == 0) { ss >> e.angle_out; continue; } | ||
|
|
@@ -311,6 +320,10 @@ Status::type read_flat_file_trackcpp(std::istream& fp, Accelerator& accelerator) | |
| accelerator.lattice.push_back(e); | ||
| } | ||
|
|
||
| if (frequencies.size() > 0) { | ||
| accelerator.frequency = frequencies[0]; | ||
| } | ||
|
|
||
| return Status::success; | ||
|
|
||
| } | ||
|
|
@@ -364,11 +377,12 @@ static Status::type read_flat_file_tracy(const std::string& filename, Accelerato | |
| case FlatFileType::cavity: | ||
| { | ||
| e.pass_method = PassMethod::pm_cavity_pass; | ||
| int hnumber; double energy; | ||
| fp >> e.voltage >> e.frequency >> hnumber >> energy; | ||
| e.voltage *= energy; e.frequency *= light_speed / (2*M_PI); | ||
| int hnumber; double energy; double freq; | ||
| fp >> e.voltage >> freq >> hnumber >> energy; | ||
| e.voltage *= energy; freq *= light_speed / (2*M_PI); | ||
| accelerator.harmonic_number = hnumber; | ||
| accelerator.energy = energy; | ||
| accelerator.frequency = freq; | ||
| }; break; | ||
| case FlatFileType::mpole: | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the default value be 1 instead of 0 ?