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

New style #106

Merged
merged 39 commits into from
Jan 30, 2023
Merged

New style #106

merged 39 commits into from
Jan 30, 2023

Conversation

neil-glikin
Copy link
Collaborator

@neil-glikin neil-glikin commented Jan 24, 2023

Broadly gives IonSim a more "functional" programming feel.

Some major changes:

  • Introduces functions for accessing all relevant fields of IonSim structs. Both for retreiving and setting field values. This changes the preferred way to interface with IonSim structs, which is through these functions. For example, rather than calling chamber.iontrap.ions, we call should call ions(chamber).
  • Sets conventions for function names (Name indicates what is returned, and underscores are avoided where possible. Phrases "get" and "set" generally avoided; functions which set values indicate this with a ! at the end of the function name. Setter functions always take in the object that's being modified as the first argument.)
  • Sample of some name changes:
    • Trap -> Chamber
    • IonConfiguration -> IonTrap
    • stark_shift -> manualshift
    • vibrational_modes -> selectedmodes
  • Changes laser strength to be in terms of intensity rather than E-field amplitude

Some minor changes:

  • Default value of keyword argument timescale in hamiltonian changed from 1e-6 to 1 (however, there is a problem when timescale=1 is actually used; see Lamb-Dicke orders cut off if timescale in hamiltonian is too large #104)
  • Allows mode size to be set in LinearChain constructor
  • Allows Ions to be constructed with sublevel aliases
  • Allows all functions which take in both a Chamber and a Laser and/or Ion to optionally index the Laser/Ion with an Int
  • Ordering of some functions rearranged

marwahaha and others added 30 commits July 19, 2022 18:14
…roved usability" -m "Functions added so far: configuration, lasers, modes, xmdes, ymodes, zmodes, ions, modecutoff!, groundstate. Changes: get_vibrational_modes -> modes, get_\eta -> lambdicke, get_basis -> basis
Convenience functions for setting laser wavelengths
Apply renaming of structs to new-style branch
…es, and change LinearChain.vibrational_modes to LinearChain.selected_modes
Change Ion.position to Ion.ionposition to match the getter function. Change set_sublevel_alias! and set_manual_shift! to sublevel_alias! and manual_shift!
ionnumber and ionposition functions now warn if not in an IonTrap. Base overrides for getproperty and setproperty removed; no function for setting sublevels added. Also, functions einsteinA and transitionmultipole now require transition to be a Tuple rather than allowing two separate arguments.
Changes: two_ion_ms -> molmersorensen2ion, rabi_flop -> rabiflop, global_beam\! -> globalbeam\!, Efield_from_pi_time(\!) -> efield_from_pitime(\!), Efield_from_rabi_frequency(\!) -> efield_from_rabifrequency(\!), bfield, matrix_element -> matrixelement, zeeman_shift -> zeemanshift, lambdicke
Function basis(Chamber) changed so that it constructs the basis. Chamber object no longer has a property Chamber.basis.
Functions: sublevel_aliases -> sublevelaliases, manual_shift -> manualshift, zero_manual_shift! -> zeromanualshift!, alias2sublevel -> sublevel, sublevel2level -> level, sublevel_alias! -> sublevelalias!, (clear_sublevel_alias!+clear_all_sublevel_aliases!) -> clearsublevelalias!, mode_structure -> modestructure. Ion fields: species_properties -> speciesproperties, sublevel_aliases -> sublevelaliases, manual_shift -> manualshift. VibrationalMode fields: mode_structure -> modestructure
selected_modes -> selectedmodes, com_frequencies -> comfrequencies, ion_traps.jl -> iontraps.jl. Also, IonTrap structs no longer have a field full_normal_mode_desicription; instead, there is a function full_normal_mode_description(LinearChain).
@neil-glikin neil-glikin requested a review from jbroz11 January 24, 2023 06:26
@neil-glikin
Copy link
Collaborator Author

Format check will fail; I think we should get rid of this for now, since it does a few undesirable things, for example spacing around math operators and spacing around the = in keyword arguments.

@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Base: 91.5% // Head: 88.5% // Decreases project coverage by -3.0% ⚠️

Coverage data is based on head (f6f9e1c) compared to base (9df6d9e).
Patch coverage: 80.7% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #106     +/-   ##
========================================
- Coverage    91.5%   88.5%   -3.0%     
========================================
  Files          15      15             
  Lines        1166    1240     +74     
========================================
+ Hits         1067    1098     +31     
- Misses         99     142     +43     
Impacted Files Coverage Δ
src/IonSim.jl 100.0% <ø> (ø)
src/timeevolution.jl 100.0% <ø> (ø)
src/iontraps.jl 87.9% <56.7%> (ø)
src/chambers.jl 71.3% <71.3%> (ø)
src/lasers.jl 81.0% <73.8%> (-16.9%) ⬇️
src/ions.jl 87.8% <84.5%> (+5.8%) ⬆️
src/vibrationalmodes.jl 90.3% <90.3%> (ø)
src/analyticfunctions.jl 100.0% <100.0%> (ø)
src/hamiltonians.jl 93.3% <100.0%> (+2.3%) ⬆️
src/operators.jl 98.6% <100.0%> (ø)
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jbroz11
Copy link
Member

jbroz11 commented Jan 30, 2023

update docs

@jbroz11 jbroz11 merged commit 0486236 into master Jan 30, 2023
@jbroz11 jbroz11 deleted the new-style branch January 30, 2023 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants